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), 13.80 KB, created by
Fujii Hironori
on 2020-01-09 03:14:02 PST
(
hide
)
Description:
WIP Patch
Filename:
MIME Type:
Creator:
Fujii Hironori
Created:
2020-01-09 03:14:02 PST
Size:
13.80 KB
patch
obsolete
>diff --git a/Source/WebCore/platform/graphics/ComplexTextController.cpp b/Source/WebCore/platform/graphics/ComplexTextController.cpp >index 8347c9fb0c2..5815da81293 100644 >--- a/Source/WebCore/platform/graphics/ComplexTextController.cpp >+++ b/Source/WebCore/platform/graphics/ComplexTextController.cpp >@@ -190,7 +190,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) >@@ -760,7 +760,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(); >@@ -811,7 +811,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) { >@@ -829,7 +829,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 1a6f73a8239..d399ebfdf7a 100644 >--- a/Source/WebCore/platform/graphics/FontCascade.cpp >+++ b/Source/WebCore/platform/graphics/FontCascade.cpp >@@ -277,10 +277,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); > } > >@@ -288,14 +288,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 >@@ -321,7 +321,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; >@@ -331,7 +331,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; > } >@@ -1398,9 +1397,9 @@ float FontCascade::getGlyphsAndAdvancesForSimpleText(const TextRun& run, unsigne > } > > #if !PLATFORM(WIN) || USE(DIRECT2D) >-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; >@@ -1408,21 +1407,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; >@@ -1455,9 +1454,7 @@ void FontCascade::drawGlyphBuffer(GraphicsContext& context, const GlyphBuffer& g > #if PLATFORM(WIN) > FloatPoint startPoint(point.x() + glyphBuffer.initialAdvance().width(), point.y() + glyphBuffer.initialAdvance().height()); > #else >- // FIXME: Why do we subtract the initial advance's height but not its width??? >- // We should use the line above from Windows instead. >- FloatPoint startPoint(point.x(), point.y() - glyphBuffer.initialAdvance().height()); >+ FloatPoint startPoint(point); > #endif > float nextX = startPoint.x() + glyphBuffer.advanceAt(0).width(); > float nextY = startPoint.y() + glyphBuffer.advanceAt(0).height(); >@@ -1664,12 +1661,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 { >@@ -1807,7 +1804,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&); > >diff --git a/Source/WebCore/platform/graphics/win/FontWin.cpp b/Source/WebCore/platform/graphics/win/FontWin.cpp >index 1caa8022e26..80f3212c6e3 100644 >--- a/Source/WebCore/platform/graphics/win/FontWin.cpp >+++ b/Source/WebCore/platform/graphics/win/FontWin.cpp >@@ -69,12 +69,12 @@ void FontCascade::adjustSelectionRectForComplexText(const TextRun& run, LayoutRe > selectionRect.setWidth(afterWidth - beforeWidth); > } > >-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 > { > if (forTextEmphasis) { > // FIXME: Add forTextEmphasis paremeter to UniscribeController and use it. > LOG_ERROR("Not implemented for text emphasis."); >- return 0; >+ return { }; > } > > UniscribeController controller(this, run); >@@ -83,7 +83,7 @@ float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsign > controller.advance(to, &glyphBuffer); > > if (glyphBuffer.isEmpty()) >- return 0; >+ return { }; > > float afterWidth = controller.runWidthSoFar(); > >@@ -91,7 +91,7 @@ float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, unsign > controller.advance(run.length()); > return controller.runWidthSoFar() - afterWidth; > } >- return beforeWidth; >+ return { beforeWidth, 0 }; > } > > float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const Font*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
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