WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
WIP patch
a.diff (text/plain), 11.46 KB, created by
Fujii Hironori
on 2020-01-09 20:19:27 PST
(
hide
)
Description:
WIP patch
Filename:
MIME Type:
Creator:
Fujii Hironori
Created:
2020-01-09 20:19:27 PST
Size:
11.46 KB
patch
obsolete
>diff --git a/Source/WebCore/platform/graphics/ComplexTextController.cpp b/Source/WebCore/platform/graphics/ComplexTextController.cpp >index 2d854384440..abdadbd6af0 100644 >--- a/Source/WebCore/platform/graphics/ComplexTextController.cpp >+++ b/Source/WebCore/platform/graphics/ComplexTextController.cpp >@@ -163,7 +163,7 @@ void ComplexTextController::finishConstruction() > > unsigned ComplexTextController::offsetForPosition(float h, bool includePartialGlyphs) > { >- if (h >= m_totalWidth) >+ if (h >= totalWidth()) > return m_run.ltr() ? m_end : 0; > > if (h < 0) >@@ -733,7 +733,7 @@ void ComplexTextController::adjustGlyphsAndAdvances() > FloatSize advance = treatAsSpace ? FloatSize(spaceWidth, advances[i].height()) : advances[i]; > > if (ch == '\t' && m_run.allowTabs()) >- advance.setWidth(m_font.tabWidth(font, m_run.tabSize(), m_run.xPos() + m_totalWidth)); >+ advance.setWidth(m_font.tabWidth(font, m_run.tabSize(), m_run.xPos() + totalWidth())); > else if (FontCascade::treatAsZeroWidthSpace(ch) && !treatAsSpace) { > advance.setWidth(0); > glyph = font.spaceGlyph(); >@@ -784,7 +784,7 @@ void ComplexTextController::adjustGlyphsAndAdvances() > complexTextRun.growInitialAdvanceHorizontally(m_expansionPerOpportunity); > } else { > m_adjustedBaseAdvances.last().expand(m_expansionPerOpportunity, 0); >- m_totalWidth += m_expansionPerOpportunity; >+ m_totalAdvance.expand(m_expansionPerOpportunity, 0); > } > } > if (expandRight) { >@@ -802,7 +802,7 @@ void ComplexTextController::adjustGlyphsAndAdvances() > afterExpansion = false; > } > >- m_totalWidth += advance.width(); >+ m_totalAdvance += advance; > > // FIXME: Combining marks should receive a text emphasis mark if they are combine with a space. > if (m_forTextEmphasis && (!FontCascade::canReceiveTextEmphasis(ch) || (U_GET_GC_MASK(ch) & U_GC_M_MASK))) >diff --git a/Source/WebCore/platform/graphics/ComplexTextController.h b/Source/WebCore/platform/graphics/ComplexTextController.h >index d8f63bf2256..07601f480f1 100644 >--- a/Source/WebCore/platform/graphics/ComplexTextController.h >+++ b/Source/WebCore/platform/graphics/ComplexTextController.h >@@ -65,7 +65,8 @@ public: > // Returns the width of everything we've consumed so far. > float runWidthSoFar() const { return m_runWidthSoFar; } > >- float totalWidth() const { return m_totalWidth; } >+ float totalWidth() const { return m_totalAdvance.width(); } >+ FloatSize totalAdance() const { return m_totalAdvance; } > > float minGlyphBoundingBoxX() const { return m_minGlyphBoundingBoxX; } > float maxGlyphBoundingBoxX() const { return m_maxGlyphBoundingBoxX; } >@@ -215,7 +216,7 @@ private: > unsigned m_currentCharacter { 0 }; > unsigned m_end { 0 }; > >- float m_totalWidth { 0 }; >+ FloatSize m_totalAdvance; > float m_runWidthSoFar { 0 }; > unsigned m_numGlyphsSoFar { 0 }; > unsigned m_currentRun { 0 }; >diff --git a/Source/WebCore/platform/graphics/FontCascade.cpp b/Source/WebCore/platform/graphics/FontCascade.cpp >index 8308f2b202a..7e5079ad12f 100644 >--- a/Source/WebCore/platform/graphics/FontCascade.cpp >+++ b/Source/WebCore/platform/graphics/FontCascade.cpp >@@ -273,10 +273,10 @@ void FontCascade::update(RefPtr<FontSelector>&& fontSelector) const > m_requiresShaping = computeRequiresShaping(); > } > >-float FontCascade::glyphBufferForTextRun(CodePath codePathToUse, const TextRun& run, unsigned from, unsigned to, GlyphBuffer& glyphBuffer) const >+FloatSize FontCascade::glyphBufferForTextRun(CodePath codePathToUse, const TextRun& run, unsigned from, unsigned to, GlyphBuffer& glyphBuffer) const > { > if (codePathToUse != Complex) >- return getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer); >+ return { getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer), 0 }; > return getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer); > } > >@@ -284,14 +284,14 @@ float FontCascade::drawText(GraphicsContext& context, const TextRun& run, const > { > unsigned destination = to.valueOr(run.length()); > GlyphBuffer glyphBuffer; >- float startX = point.x() + glyphBufferForTextRun(codePath(run, from, to), run, from, destination, glyphBuffer); >+ FloatPoint startPoint = point + glyphBufferForTextRun(codePath(run, from, to), run, from, destination, glyphBuffer); > // We couldn't generate any glyphs for the run. Give up. > if (glyphBuffer.isEmpty()) > return 0; > // Draw the glyph buffer now at the starting point returned in startX. >- FloatPoint startPoint(startX, point.y()); >+ FloatPoint oldStartPoint(startPoint); > drawGlyphBuffer(context, glyphBuffer, startPoint, customFontNotReadyAction); >- return startPoint.x() - startX; >+ return startPoint.x() - oldStartPoint.x(); > } > > void FontCascade::drawEmphasisMarks(GraphicsContext& context, const TextRun& run, const AtomString& mark, const FloatPoint& point, unsigned from, Optional<unsigned> to) const >@@ -317,7 +317,7 @@ std::unique_ptr<DisplayList::DisplayList> FontCascade::displayListForTextRun(Gra > codePathToUse = Complex; > > GlyphBuffer glyphBuffer; >- float startX = glyphBufferForTextRun(codePathToUse, run, from, destination, glyphBuffer); >+ FloatPoint startPoint = toFloatPoint(glyphBufferForTextRun(codePathToUse, run, from, destination, glyphBuffer)); > // We couldn't generate any glyphs for the run. Give up. > if (glyphBuffer.isEmpty()) > return nullptr; >@@ -327,7 +327,6 @@ std::unique_ptr<DisplayList::DisplayList> FontCascade::displayListForTextRun(Gra > return makeUnique<DisplayList::Recorder>(displayListContext, *displayList, context.state(), FloatRect(), AffineTransform()); > }); > >- FloatPoint startPoint(startX, 0); > drawGlyphBuffer(recordingContext, glyphBuffer, startPoint, customFontNotReadyAction); > return displayList; > } >@@ -1383,9 +1382,9 @@ float FontCascade::getGlyphsAndAdvancesForSimpleText(const TextRun& run, unsigne > return initialAdvance; > } > >-float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsigned from, unsigned to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const >+FloatSize FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsigned from, unsigned to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const > { >- float initialAdvance; >+ FloatSize initialAdvance; > > ComplexTextController controller(*this, run, false, 0, forTextEmphasis); > GlyphBuffer dummyGlyphBuffer; >@@ -1393,21 +1392,21 @@ float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsign > controller.advance(to, &glyphBuffer); > > if (glyphBuffer.isEmpty()) >- return 0; >+ return { }; > > if (run.rtl()) { > // Exploit the fact that the sum of the paint advances is equal to > // the sum of the layout advances. >- initialAdvance = controller.totalWidth(); >+ initialAdvance = controller.totalAdance(); > for (unsigned i = 0; i < dummyGlyphBuffer.size(); ++i) >- initialAdvance -= dummyGlyphBuffer.advanceAt(i).width(); >+ initialAdvance -= dummyGlyphBuffer.advanceAt(i); > for (unsigned i = 0; i < glyphBuffer.size(); ++i) >- initialAdvance -= glyphBuffer.advanceAt(i).width(); >+ initialAdvance -= glyphBuffer.advanceAt(i); > glyphBuffer.reverse(0, glyphBuffer.size()); > } else { >- initialAdvance = dummyGlyphBuffer.initialAdvance().width(); >+ initialAdvance = dummyGlyphBuffer.initialAdvance(); > for (unsigned i = 0; i < dummyGlyphBuffer.size(); ++i) >- initialAdvance += dummyGlyphBuffer.advanceAt(i).width(); >+ initialAdvance += dummyGlyphBuffer.advanceAt(i); > } > > return initialAdvance; >@@ -1636,12 +1635,12 @@ const Font* FontCascade::fontForCombiningCharacterSequence(const UChar* characte > void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext& context, const TextRun& run, const AtomString& mark, const FloatPoint& point, unsigned from, unsigned to) const > { > GlyphBuffer glyphBuffer; >- float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis); >+ auto initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis); > > if (glyphBuffer.isEmpty()) > return; > >- drawEmphasisMarks(context, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y())); >+ drawEmphasisMarks(context, glyphBuffer, mark, point + initialAdvance); > } > > struct GlyphIterationState { >@@ -1779,7 +1778,7 @@ DashArray FontCascade::dashesForIntersectionsWithRect(const TextRun& run, const > if (codePath(run) != FontCascade::Complex) > deltaX = getGlyphsAndAdvancesForSimpleText(run, 0, run.length(), glyphBuffer); > else >- deltaX = getGlyphsAndAdvancesForComplexText(run, 0, run.length(), glyphBuffer); >+ deltaX = getGlyphsAndAdvancesForComplexText(run, 0, run.length(), glyphBuffer).width(); > > if (!glyphBuffer.size()) > return DashArray(); >diff --git a/Source/WebCore/platform/graphics/FontCascade.h b/Source/WebCore/platform/graphics/FontCascade.h >index 897cd978f84..f50b7cd46fb 100644 >--- a/Source/WebCore/platform/graphics/FontCascade.h >+++ b/Source/WebCore/platform/graphics/FontCascade.h >@@ -203,7 +203,7 @@ public: > private: > enum ForTextEmphasisOrNot { NotForTextEmphasis, ForTextEmphasis }; > >- float glyphBufferForTextRun(CodePath, const TextRun&, unsigned from, unsigned to, GlyphBuffer&) const; >+ FloatSize glyphBufferForTextRun(CodePath, const TextRun&, unsigned from, unsigned to, GlyphBuffer&) const; > // Returns the initial in-stream advance. > float getGlyphsAndAdvancesForSimpleText(const TextRun&, unsigned from, unsigned to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; > void drawEmphasisMarksForSimpleText(GraphicsContext&, const TextRun&, const AtomString& mark, const FloatPoint&, unsigned from, unsigned to) const; >@@ -219,7 +219,7 @@ private: > static bool canExpandAroundIdeographsInComplexText(); > > // Returns the initial in-stream advance. >- float getGlyphsAndAdvancesForComplexText(const TextRun&, unsigned from, unsigned to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; >+ FloatSize getGlyphsAndAdvancesForComplexText(const TextRun&, unsigned from, unsigned to, GlyphBuffer&, ForTextEmphasisOrNot = NotForTextEmphasis) const; > void drawEmphasisMarksForComplexText(GraphicsContext&, const TextRun&, const AtomString& mark, const FloatPoint&, unsigned from, unsigned to) const; > float floatWidthForComplexText(const TextRun&, HashSet<const Font*>* fallbackFonts = 0, GlyphOverflow* = 0) const; > int offsetForPositionForComplexText(const TextRun&, float position, bool includePartialGlyphs) const; >diff --git a/Source/WebCore/platform/graphics/GlyphBuffer.h b/Source/WebCore/platform/graphics/GlyphBuffer.h >index 7b56a37c283..a060679b8fa 100644 >--- a/Source/WebCore/platform/graphics/GlyphBuffer.h >+++ b/Source/WebCore/platform/graphics/GlyphBuffer.h >@@ -63,6 +63,8 @@ public: > { > } > >+ operator FloatSize() const { return FloatSize(width(), height()); } >+ > template<class Encoder> void encode(Encoder&) const; > template<class Decoder> static Optional<GlyphBufferAdvance> decode(Decoder&); >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 205990
:
387194
|
387195
|
387197
|
387203
|
387207
|
387209
|
387210
|
387211
|
387310
|
387314
|
388011
|
388019
|
388020
|
388021
|
388022
|
388209
|
388271
|
388274