int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyphs) const { if (codePath(run) != Complex) return offsetForPositionForSimpleText(run, x, includePartialGlyphs); return offsetForPositionForComplexText(run, x, includePartialGlyphs); }
void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { // Don't draw anything while we are using custom fonts that are in the process of loading. if (loadingCustomFonts()) return; to = (to == -1 ? run.length() : to); #if ENABLE(SVG_FONTS) if (primaryFont()->isSVGFont()) { drawTextUsingSVGFont(context, run, point, from, to); return; } #endif CodePath codePathToUse = codePath(run); #if PLATFORM(QT) && HAVE(QRAWFONT) if (context->textDrawingMode() & TextModeStroke || context->contextShadow()->m_type != ContextShadow::NoShadow) codePathToUse = Complex; #endif if (codePathToUse != Complex) return drawSimpleText(context, run, point, from, to); return drawComplexText(context, run, point, from, to); }
// // Construct a Process object. // Process::Process(TaskPort taskPort, const ClientSetupInfo *info, const CommonCriteria::AuditToken &audit) : mTaskPort(taskPort), mByteFlipped(false), mPid(mTaskPort.pid()), mUid(0), mGid(0) { StLock<Mutex> _(*this); // set parent session parent(Session::find(audit.sessionId(), true)); // let's take a look at our wannabe client... if (mTaskPort.pid() != mPid) { secnotice("SS", "Task/pid setup mismatch pid=%d task=%d(%d)", mPid, mTaskPort.port(), mTaskPort.pid()); CssmError::throwMe(CSSMERR_CSSM_ADDIN_AUTHENTICATE_FAILED); // you lied! } setup(info); ClientIdentification::setup(this->pid()); // NB: ServerChild::find() should only be used to determine // *existence*. Don't use the returned Child object for anything else, // as it is not protected against its underlying process's destruction. if (this->pid() == getpid() // called ourselves (through some API). Do NOT record this as a "dirty" transaction || ServerChild::find<ServerChild>(this->pid())) // securityd's child; do not mark this txn dirty VProc::Transaction::deactivate(); secinfo("SS", "%p client new: pid:%d session:%d %s taskPort:%d uid:%d gid:%d", this, this->pid(), this->session().sessionId(), (char *)codePath(this->processCode()).c_str(), taskPort.port(), mUid, mGid); }
float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const { CodePath codePathToUse = codePath(run); if (codePathToUse != ComplexPath) { // The complex path is more restrictive about returning fallback fonts than the simple path, so we need an explicit test to make their behaviors match. if (!FontPlatformFeatures::canReturnFallbackFontsForComplexText()) fallbackFonts = 0; // The simple path can optimize the case where glyph overflow is not observable. if (codePathToUse != SimpleWithGlyphOverflowPath && (glyphOverflow && !glyphOverflow->computeBounds)) glyphOverflow = 0; } bool hasKerningOrLigatures = fontDescription().typesettingFeatures() & (Kerning | Ligatures); bool hasWordSpacingOrLetterSpacing = fontDescription().wordSpacing() || fontDescription().letterSpacing(); float* cacheEntry = m_fontFallbackList->widthCache().add(run, std::numeric_limits<float>::quiet_NaN(), hasKerningOrLigatures, hasWordSpacingOrLetterSpacing, glyphOverflow); if (cacheEntry && !std::isnan(*cacheEntry)) return *cacheEntry; float result; if (codePathToUse == ComplexPath) result = floatWidthForComplexText(run, fallbackFonts, glyphOverflow); else result = floatWidthForSimpleText(run, fallbackFonts, glyphOverflow); if (cacheEntry && (!fallbackFonts || fallbackFonts->isEmpty())) *cacheEntry = result; return result; }
int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyphs) const { // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 if (codePath(run) != Complex && !typesettingFeatures()) return offsetForPositionForSimpleText(run, x, includePartialGlyphs); return offsetForPositionForComplexText(run, x, includePartialGlyphs); }
FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const { to = (to == -1 ? run.length() : to); if (codePath(run) != Complex) return selectionRectForSimpleText(run, point, h, from, to); return selectionRectForComplexText(run, point, h, from, to); }
DashArray FontCascade::dashesForIntersectionsWithRect(const TextRun& run, const FloatPoint& textOrigin, const FloatRect& lineExtents) const { if (isLoadingCustomFonts()) return DashArray(); GlyphBuffer glyphBuffer; glyphBuffer.saveOffsetsInString(); float deltaX; if (codePath(run) != FontCascade::Complex) deltaX = getGlyphsAndAdvancesForSimpleText(run, 0, run.length(), glyphBuffer); else deltaX = getGlyphsAndAdvancesForComplexText(run, 0, run.length(), glyphBuffer); if (!glyphBuffer.size()) return DashArray(); // FIXME: Handle SVG + non-SVG interleaved runs. https://bugs.webkit.org/show_bug.cgi?id=133778 FloatPoint origin = FloatPoint(textOrigin.x() + deltaX, textOrigin.y()); std::unique_ptr<GlyphToPathTranslator> translator = std::make_unique<CairoGlyphToPathTranslator>(run, glyphBuffer, origin); DashArray result; for (int index = 0; translator->containsMorePaths(); ++index, translator->advance()) { float centerOfLine = lineExtents.y() + (lineExtents.height() / 2); GlyphIterationState info = GlyphIterationState(FloatPoint(), FloatPoint(), centerOfLine, lineExtents.x() + lineExtents.width(), lineExtents.x()); const Font* localFontData = glyphBuffer.fontAt(index); if (!localFontData) { // The advances will get all messed up if we do anything other than bail here. result.clear(); break; } switch (translator->underlineType()) { case GlyphToPathTranslator::GlyphUnderlineType::SkipDescenders: { Path path = translator->path(); path.apply([&info](const PathElement& pathElement) { findPathIntersections(info, pathElement); }); if (info.minX < info.maxX) { result.append(info.minX - lineExtents.x()); result.append(info.maxX - lineExtents.x()); } break; } case GlyphToPathTranslator::GlyphUnderlineType::SkipGlyph: { std::pair<float, float> extents = translator->extents(); result.append(extents.first - lineExtents.x()); result.append(extents.second - lineExtents.x()); break; } case GlyphToPathTranslator::GlyphUnderlineType::DrawOverGlyph: // Nothing to do break; } } return result; }
int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyphs) const { #if ENABLE(SVG_FONTS) if (primaryFont()->isSVGFont()) return offsetForPositionForTextUsingSVGFont(run, x, includePartialGlyphs); #endif if (codePath(run) != Complex) return offsetForPositionForSimpleText(run, x, includePartialGlyphs); return offsetForPositionForComplexText(run, x, includePartialGlyphs); }
float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const { CodePath codePathToUse = codePath(run); if (codePathToUse != Complex) { // If the complex text implementation cannot return fallback fonts, avoid // returning them for simple text as well. static bool returnFallbackFonts = canReturnFallbackFontsForComplexText(); return floatWidthForSimpleText(run, 0, returnFallbackFonts ? fallbackFonts : 0, codePathToUse == SimpleWithGlyphOverflow || (glyphOverflow && glyphOverflow->computeBounds) ? glyphOverflow : 0); } return floatWidthForComplexText(run, fallbackFonts, glyphOverflow); }
void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const { if (loadingCustomFonts()) return; if (to < 0) to = run.length(); if (codePath(run) != Complex) drawEmphasisMarksForSimpleText(context, run, mark, point, from, to); else drawEmphasisMarksForComplexText(context, run, mark, point, from, to); }
FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const { to = (to == -1 ? run.length() : to); CodePath codePathToUse = codePath(run); // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 if (codePathToUse != Complex && typesettingFeatures() && (from || to != run.length())) codePathToUse = Complex; if (codePathToUse != Complex) return selectionRectForSimpleText(run, point, h, from, to); return selectionRectForComplexText(run, point, h, from, to); }
FloatRect Font::selectionRectForText(const TextRun& run, const FloatPoint& point, int h, int from, int to) const { #if ENABLE(SVG_FONTS) if (primaryFont()->isSVGFont()) return selectionRectForTextUsingSVGFont(run, point, h, from, to); #endif to = (to == -1 ? run.length() : to); if (codePath(run) != Complex) return selectionRectForSimpleText(run, point, h, from, to); return selectionRectForComplexText(run, point, h, from, to); }
void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { // Don't draw anything while we are using custom fonts that are in the process of loading. if (loadingCustomFonts()) return; to = (to == -1 ? run.length() : to); CodePath codePathToUse = codePath(run); if (codePathToUse != Complex) return drawSimpleText(context, run, point, from, to); return drawComplexText(context, run, point, from, to); }
void Font::drawEmphasisMarks(GraphicsContext* context, const TextRunPaintInfo& runInfo, const AtomicString& mark, const FloatPoint& point) const { if (loadingCustomFonts()) return; CodePath codePathToUse = codePath(runInfo.run); // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (runInfo.from || runInfo.to != runInfo.run.length())) codePathToUse = ComplexPath; if (codePathToUse != ComplexPath) drawEmphasisMarksForSimpleText(context, runInfo, mark, point); else drawEmphasisMarksForComplexText(context, runInfo, mark, point); }
float Font::width(const TextRun& run, int& charsConsumed, String& glyphName) const { #if ENABLE(SVG_FONTS) if (TextRun::RenderingContext* renderingContext = run.renderingContext()) return renderingContext->floatWidthUsingSVGFont(*this, run, charsConsumed, glyphName); #endif charsConsumed = run.length(); glyphName = ""; if (codePath(run) != Complex) return floatWidthForSimpleText(run, 0); return floatWidthForComplexText(run); }
float Font::width(const TextRun& run, int extraCharsAvailable, int& charsConsumed, String& glyphName) const { #if !ENABLE(SVG_FONTS) UNUSED_PARAM(extraCharsAvailable); #else if (primaryFont()->isSVGFont()) return floatWidthUsingSVGFont(run, extraCharsAvailable, charsConsumed, glyphName); #endif charsConsumed = run.length(); glyphName = ""; if (codePath(run) != Complex) return floatWidthForSimpleText(run, 0); return floatWidthForComplexText(run); }
float Font::floatWidth(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const { #if ENABLE(SVG_FONTS) if (primaryFont()->isSVGFont()) return floatWidthUsingSVGFont(run); #endif CodePath codePathToUse = codePath(run); if (codePathToUse != Complex) { // If the complex text implementation cannot return fallback fonts, avoid // returning them for simple text as well. static bool returnFallbackFonts = canReturnFallbackFontsForComplexText(); return floatWidthForSimpleText(run, 0, returnFallbackFonts ? fallbackFonts : 0, codePathToUse == SimpleWithGlyphOverflow ? glyphOverflow : 0); } return floatWidthForComplexText(run, fallbackFonts, glyphOverflow); }
void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { // Don't draw anything while we are using custom fonts that are in the process of loading. if (loadingCustomFonts()) return; to = (to == -1 ? run.length() : to); CodePath codePathToUse = codePath(run); // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 if (codePathToUse != Complex && typesettingFeatures() && (from || to != run.length())) codePathToUse = Complex; if (codePathToUse != Complex) return drawSimpleText(context, run, point, from, to); return drawComplexText(context, run, point, from, to); }
void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const { if (loadingCustomFonts()) return; if (to < 0) to = run.length(); CodePath codePathToUse = codePath(run); // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 if (codePathToUse != Complex && typesettingFeatures() && (from || to != run.length())) codePathToUse = Complex; if (codePathToUse != Complex) drawEmphasisMarksForSimpleText(context, run, mark, point, from, to); else drawEmphasisMarksForComplexText(context, run, mark, point, from, to); }
void Font::drawText(GraphicsContext* context, const TextRunPaintInfo& runInfo, const FloatPoint& point, CustomFontNotReadyAction customFontNotReadyAction) const { // Don't draw anything while we are using custom fonts that are in the process of loading, // except if the 'force' argument is set to true (in which case it will use a fallback // font). if (loadingCustomFonts() && customFontNotReadyAction == DoNotPaintIfFontNotReady) return; CodePath codePathToUse = codePath(runInfo.run); // FIXME: Use the fast code path once it handles partial runs with kerning and ligatures. See http://webkit.org/b/100050 if (codePathToUse != ComplexPath && fontDescription().typesettingFeatures() && (runInfo.from || runInfo.to != runInfo.run.length())) codePathToUse = ComplexPath; if (codePathToUse != ComplexPath) return drawSimpleText(context, runInfo, point); return drawComplexText(context, runInfo, point); }
void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const { if (loadingCustomFonts()) return; if (to < 0) to = run.length(); #if ENABLE(SVG_FONTS) // FIXME: Implement for SVG fonts. if (primaryFont()->isSVGFont()) return; #endif if (codePath(run) != Complex) drawEmphasisMarksForSimpleText(context, run, mark, point, from, to); else drawEmphasisMarksForComplexText(context, run, mark, point, from, to); }
void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { // Don't draw anything while we are using custom fonts that are in the process of loading. if (loadingCustomFonts()) return; to = (to == -1 ? run.length() : to); CodePath codePathToUse = codePath(run); #if PLATFORM(QT) && HAVE(QRAWFONT) if (context->textDrawingMode() & TextModeStroke) codePathToUse = Complex; #endif if (codePathToUse != Complex) return drawSimpleText(context, run, point, from, to); return drawComplexText(context, run, point, from, to); }
void Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const { // Don't draw anything while we are using custom fonts that are in the process of loading. if (loadingCustomFonts()) return; to = (to == -1 ? run.length() : to); #if ENABLE(SVG_FONTS) if (primaryFont()->isSVGFont()) { drawTextUsingSVGFont(context, run, point, from, to); return; } #endif if (codePath(run) != Complex) return drawSimpleText(context, run, point, from, to); return drawComplexText(context, run, point, from, to); }
// // Support for the legacy hash identification mechanism. // The legacy machinery deals exclusively in terms of processes. // It knows nothing about guests and their identities. // string ClientIdentification::getPath() const { assert(mClientProcess); return codePath(currentGuest()); }