platform/graphics/FloatRect.cpp
platform/graphics/FloatRoundedRect.cpp
platform/graphics/FloatSize.cpp
- platform/graphics/Font.cpp
platform/graphics/FontCache.cpp
+ platform/graphics/FontCascade.cpp
platform/graphics/FontDescription.cpp
platform/graphics/FontFastPath.cpp
platform/graphics/FontFeatureSettings.cpp
+2015-01-15 Antti Koivisto <antti@apple.com>
+
+ Rename Font to FontCascade
+ https://bugs.webkit.org/show_bug.cgi?id=140442
+
+ Reviewed by Darin Adler.
+
+ We can then rename SimpleFontData to Font. This will match the usual definition of a "font".
+
2015-01-15 Mihnea Ovidenie <mihnea@adobe.com>
[CSSRegions] Assert failure in RenderBlock::locateFlowThreadContainingBlock when showing the render tree debug info
__ZN7WebCore11FileChooser10chooseFileERKN3WTF6StringE
__ZN7WebCore11FileChooser11chooseFilesERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEE
__ZN7WebCore11FileChooserD1Ev
+__ZN7WebCore11FontCascade11setCodePathENS0_8CodePathE
+__ZN7WebCore11FontCascade18shouldUseSmoothingEv
+__ZN7WebCore11FontCascade21setShouldUseSmoothingEb
+__ZN7WebCore11FontCascade29setDefaultTypesettingFeaturesEj
+__ZN7WebCore11FontCascadeC1ERKNS_16FontPlatformDataEbNS_17FontSmoothingModeE
+__ZN7WebCore11FontCascadeC1Ev
+__ZN7WebCore11FontCascadeaSERKS0_
__ZN7WebCore11FrameLoader11loadArchiveEN3WTF10PassRefPtrINS_7ArchiveEEE
__ZN7WebCore11FrameLoader11shouldCloseEv
__ZN7WebCore11FrameLoader11urlSelectedERKNS_3URLERKN3WTF6StringENS4_10PassRefPtrINS_5EventEEENS_11LockHistoryENS_19LockBackForwardListENS_18ShouldSendReferrerE
__ZN7WebCore15SQLiteStatementD1Ev
__ZN7WebCore15ScrollAlignment17alignCenterAlwaysE
__ZN7WebCore15ScrollAlignment19alignToEdgeIfNeededE
-__ZN7WebCore15StringTruncator13rightTruncateERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotE
-__ZN7WebCore15StringTruncator14centerTruncateERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotE
-__ZN7WebCore15StringTruncator5widthERKN3WTF6StringERKNS_4FontENS0_24EnableRoundingHacksOrNotE
+__ZN7WebCore15StringTruncator13rightTruncateERKN3WTF6StringEfRKNS_11FontCascadeENS0_24EnableRoundingHacksOrNotE
+__ZN7WebCore15StringTruncator14centerTruncateERKN3WTF6StringEfRKNS_11FontCascadeENS0_24EnableRoundingHacksOrNotE
+__ZN7WebCore15StringTruncator5widthERKN3WTF6StringERKNS_11FontCascadeENS0_24EnableRoundingHacksOrNotE
__ZN7WebCore15UserInputBridge11loadRequestERKNS_16FrameLoadRequestENS_11InputSourceE
__ZN7WebCore15UserInputBridge11reloadFrameEPNS_5FrameEbNS_11InputSourceE
__ZN7WebCore15UserInputBridge12tryClosePageENS_11InputSourceE
__ZN7WebCore40restrictMinimumScaleFactorToViewportSizeERNS_18ViewportAttributesENS_7IntSizeEf
__ZN7WebCore42URLByTruncatingOneCharacterBeforeComponentEP5NSURL18CFURLComponentType
__ZN7WebCore47attributedStringByStrippingAttachmentCharactersEP18NSAttributedString
-__ZN7WebCore4Font11setCodePathENS0_8CodePathE
-__ZN7WebCore4Font18shouldUseSmoothingEv
-__ZN7WebCore4Font21setShouldUseSmoothingEb
-__ZN7WebCore4Font29setDefaultTypesettingFeaturesEj
-__ZN7WebCore4FontC1ERKNS_16FontPlatformDataEbNS_17FontSmoothingModeE
-__ZN7WebCore4FontC1Ev
-__ZN7WebCore4FontaSERKS0_
__ZN7WebCore4Icon18createIconForFilesERKN3WTF6VectorINS1_6StringELm0ENS1_15CrashOnOverflowEEE
__ZN7WebCore4IconD1Ev
__ZN7WebCore4Node10renderRectEPb
__ZNK7WebCore10TimeRanges4copyEv
__ZNK7WebCore10TimeRanges5startEjRi
__ZNK7WebCore10TimeRanges6lengthEv
+__ZNK7WebCore11FontCascade5widthERKNS_7TextRunEPN3WTF7HashSetIPKNS_14SimpleFontDataENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE
+__ZNK7WebCore11FontCascade8drawTextEPNS_15GraphicsContextERKNS_7TextRunERKNS_10FloatPointEiiNS0_24CustomFontNotReadyActionE
+__ZNK7WebCore11FontCascadeeqERKS0_
__ZNK7WebCore11FrameLoader10isCompleteEv
__ZNK7WebCore11FrameLoader14cancelledErrorERKNS_15ResourceRequestE
__ZNK7WebCore11FrameLoader14frameHasLoadedEv
__ZNK7WebCore11RenderBlock25inlineElementContinuationEv
__ZNK7WebCore11RenderLayer19absoluteBoundingBoxEv
__ZNK7WebCore11RenderLayer24needsCompositedScrollingEv
+__ZNK7WebCore11RenderStyle11fontCascadeEv
__ZNK7WebCore11RenderStyle11fontMetricsEv
__ZNK7WebCore11RenderStyle15fontDescriptionEv
__ZNK7WebCore11RenderStyle21visitedDependentColorEi
-__ZNK7WebCore11RenderStyle4fontEv
__ZNK7WebCore12RenderInline16linesBoundingBoxEv
__ZNK7WebCore12RenderObject14enclosingLayerEv
__ZNK7WebCore12RenderObject15localToAbsoluteERKNS_10FloatPointEj
__ZNK7WebCore3URL5queryEv
__ZNK7WebCore3URL8protocolEv
__ZNK7WebCore3URLcvP5NSURLEv
-__ZNK7WebCore4Font5widthERKNS_7TextRunEPN3WTF7HashSetIPKNS_14SimpleFontDataENS4_7PtrHashIS8_EENS4_10HashTraitsIS8_EEEEPNS_13GlyphOverflowE
-__ZNK7WebCore4Font8drawTextEPNS_15GraphicsContextERKNS_7TextRunERKNS_10FloatPointEiiNS0_24CustomFontNotReadyActionE
-__ZNK7WebCore4FonteqERKS0_
__ZNK7WebCore4Node10shadowHostEv
__ZNK7WebCore4Node11textContentEb
__ZNK7WebCore4Node13ownerDocumentEv
__ZN7WebCore15DatabaseTracker38emptyDatabaseFilesRemovalTaskDidFinishEv
__ZN7WebCore15DatabaseTracker44emptyDatabaseFilesRemovalTaskWillBeScheduledEv
__ZN7WebCore15DatabaseTracker7trackerEv
-__ZN7WebCore15GraphicsContext12drawBidiTextERKNS_4FontERKNS_7TextRunERKNS_10FloatPointENS1_24CustomFontNotReadyActionEPNS_10BidiStatusEi
__ZN7WebCore15GraphicsContext15drawLineForTextERKNS_10FloatPointEfbb
__ZN7WebCore15GraphicsContext22setEmojiDrawingEnabledEb
__ZN7WebCore15GraphicsContext23setIsAcceleratedContextEb
__ZN7WebCore15LegacyTileCache14drainLayerPoolEv
__ZN7WebCore15LegacyTileCache20setLayerPoolCapacityEj
__ZN7WebCore15ResourceRequest41updateFromDelegatePreservingOldPropertiesERKS0_
-__ZN7WebCore15StringTruncator12leftTruncateERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotERfbf
-__ZN7WebCore15StringTruncator13rightTruncateERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotERfbf
-__ZN7WebCore15StringTruncator14centerTruncateERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotERfbf
-__ZN7WebCore15StringTruncator15rightClipToWordERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotERfbfb
-__ZN7WebCore15StringTruncator20rightClipToCharacterERKN3WTF6StringEfRKNS_4FontENS0_24EnableRoundingHacksOrNotERfbf
__ZN7WebCore15isEndOfDocumentERKNS_15VisiblePositionE
__ZN7WebCore15startOfDocumentEPKNS_4NodeE
__ZN7WebCore15startOfDocumentERKNS_15VisiblePositionE
__ZN7WebCore35isEndOfEditableOrNonEditableContentERKNS_15VisiblePositionE
__ZN7WebCore35positionOfNextBoundaryOfGranularityERKNS_15VisiblePositionENS_15TextGranularityENS_18SelectionDirectionE
__ZN7WebCore41initializeHTTPConnectionSettingsOnStartupEv
-__ZN7WebCore4FontC1ERKNS_16FontPlatformDataEN3WTF10PassRefPtrINS_12FontSelectorEEE
__ZN7WebCore4Icon18createIconForImageEP7CGImage
__ZN7WebCore4Node17isContentEditableENS0_22UserSelectAllTreatmentE
__ZN7WebCore4Node23compareDocumentPositionEPS0_
<ClCompile Include="..\platform\graphics\FloatRect.cpp" />
<ClCompile Include="..\platform\graphics\FloatRoundedRect.cpp" />
<ClCompile Include="..\platform\graphics\FloatSize.cpp" />
- <ClCompile Include="..\platform\graphics\Font.cpp" />
<ClCompile Include="..\platform\graphics\FontCache.cpp" />
+ <ClCompile Include="..\platform\graphics\FontCascade.cpp" />
<ClCompile Include="..\platform\graphics\FontDescription.cpp" />
<ClCompile Include="..\platform\graphics\FontGenericFamilies.cpp" />
<ClCompile Include="..\platform\graphics\FontGlyphs.cpp" />
<ClInclude Include="..\platform\graphics\FloatRoundedRect.h" />
<ClInclude Include="..\platform\graphics\FloatSize.h" />
<ClInclude Include="..\platform\graphics\FloatSizeHash.h" />
- <ClInclude Include="..\platform\graphics\Font.h" />
<ClInclude Include="..\platform\graphics\FontCache.h" />
+ <ClInclude Include="..\platform\graphics\FontCascade.h" />
<ClInclude Include="..\platform\graphics\FontDescription.h" />
<ClInclude Include="..\platform\graphics\FontGenericFamilies.h" />
<ClInclude Include="..\platform\graphics\FontGlyphs.h" />
B2C3DA490D006C1D00EF6F26 /* TextEncodingRegistry.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA190D006C1D00EF6F26 /* TextEncodingRegistry.h */; settings = {ATTRIBUTES = (Private, ); }; };
B2C3DA4A0D006C1D00EF6F26 /* TextStream.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA1A0D006C1D00EF6F26 /* TextStream.cpp */; };
B2C3DA4B0D006C1D00EF6F26 /* TextStream.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA1B0D006C1D00EF6F26 /* TextStream.h */; settings = {ATTRIBUTES = (Private, ); }; };
- B2C3DA600D006CD600EF6F26 /* Font.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA4F0D006CD600EF6F26 /* Font.cpp */; };
- B2C3DA610D006CD600EF6F26 /* Font.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA500D006CD600EF6F26 /* Font.h */; settings = {ATTRIBUTES = (Private, ); }; };
+ B2C3DA600D006CD600EF6F26 /* FontCascade.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA4F0D006CD600EF6F26 /* FontCascade.cpp */; };
+ B2C3DA610D006CD600EF6F26 /* FontCascade.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA500D006CD600EF6F26 /* FontCascade.h */; settings = {ATTRIBUTES = (Private, ); }; };
B2C3DA620D006CD600EF6F26 /* FontCache.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA510D006CD600EF6F26 /* FontCache.cpp */; };
B2C3DA630D006CD600EF6F26 /* FontCache.h in Headers */ = {isa = PBXBuildFile; fileRef = B2C3DA520D006CD600EF6F26 /* FontCache.h */; settings = {ATTRIBUTES = (Private, ); }; };
B2C3DA640D006CD600EF6F26 /* SimpleFontData.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */; };
B2C3DA190D006C1D00EF6F26 /* TextEncodingRegistry.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextEncodingRegistry.h; sourceTree = "<group>"; };
B2C3DA1A0D006C1D00EF6F26 /* TextStream.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TextStream.cpp; sourceTree = "<group>"; };
B2C3DA1B0D006C1D00EF6F26 /* TextStream.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextStream.h; sourceTree = "<group>"; };
- B2C3DA4F0D006CD600EF6F26 /* Font.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = Font.cpp; sourceTree = "<group>"; };
- B2C3DA500D006CD600EF6F26 /* Font.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = Font.h; sourceTree = "<group>"; };
+ B2C3DA4F0D006CD600EF6F26 /* FontCascade.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontCascade.cpp; sourceTree = "<group>"; };
+ B2C3DA500D006CD600EF6F26 /* FontCascade.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontCascade.h; sourceTree = "<group>"; };
B2C3DA510D006CD600EF6F26 /* FontCache.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = FontCache.cpp; sourceTree = "<group>"; };
B2C3DA520D006CD600EF6F26 /* FontCache.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = FontCache.h; sourceTree = "<group>"; };
B2C3DA530D006CD600EF6F26 /* SimpleFontData.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = SimpleFontData.cpp; sourceTree = "<group>"; };
B27535380B053814002CE64F /* Color.cpp */,
B27535390B053814002CE64F /* Color.h */,
9382DF5710A8D5C900925652 /* ColorSpace.h */,
+ B2C3DA4F0D006CD600EF6F26 /* FontCascade.cpp */,
+ B2C3DA500D006CD600EF6F26 /* FontCascade.h */,
2D2FC0541460CD6F00263633 /* CrossfadeGeneratedImage.cpp */,
2D2FC0551460CD6F00263633 /* CrossfadeGeneratedImage.h */,
A8CB41020E85B8A50032C4F0 /* DashArray.h */,
B275353E0B053814002CE64F /* FloatSize.cpp */,
B275353F0B053814002CE64F /* FloatSize.h */,
58CD35CA18EB4C3900B9F3AC /* FloatSizeHash.h */,
- B2C3DA4F0D006CD600EF6F26 /* Font.cpp */,
- B2C3DA500D006CD600EF6F26 /* Font.h */,
BCB92D4E1293550B00C8387F /* FontBaseline.h */,
B2C3DA510D006CD600EF6F26 /* FontCache.cpp */,
B2C3DA520D006CD600EF6F26 /* FontCache.h */,
14993BE60B2F2B1C0050497F /* FocusController.h in Headers */,
062287840B4DB322000C34DF /* FocusDirection.h in Headers */,
B6D9D23514EABD260090D75E /* FocusEvent.h in Headers */,
- B2C3DA610D006CD600EF6F26 /* Font.h in Headers */,
+ B2C3DA610D006CD600EF6F26 /* FontCascade.h in Headers */,
BCB92D4F1293550B00C8387F /* FontBaseline.h in Headers */,
B2C3DA630D006CD600EF6F26 /* FontCache.h in Headers */,
B2AFFC7E0D00A5C10030074D /* FontCustomPlatformData.h in Headers */,
D72F6D79153159A3001EE44E /* FlowThreadController.cpp in Sources */,
14993BE50B2F2B1C0050497F /* FocusController.cpp in Sources */,
B6D9D23614EABD260090D75E /* FocusEvent.cpp in Sources */,
- B2C3DA600D006CD600EF6F26 /* Font.cpp in Sources */,
+ B2C3DA600D006CD600EF6F26 /* FontCascade.cpp in Sources */,
B2C3DA620D006CD600EF6F26 /* FontCache.cpp in Sources */,
3727DFD5142AAE4500D449CB /* FontCacheIOS.mm in Sources */,
B2AFFC7C0D00A5C10030074D /* FontCacheMac.mm in Sources */,
#include "AccessibilityObject.h"
#include "Document.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "FrameView.h"
#include "HTMLParserIdioms.h"
#include "HostWindow.h"
result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_INDENT), buffer.get());
}
- String fontFamilyName = style->font().firstFamily();
+ String fontFamilyName = style->fontCascade().firstFamily();
if (fontFamilyName.left(8) == "-webkit-")
fontFamilyName = fontFamilyName.substring(8);
result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_FAMILY_NAME), fontFamilyName.utf8().data());
int fontWeight = -1;
- switch (style->font().weight()) {
+ switch (style->fontCascade().weight()) {
case FontWeight100:
fontWeight = 100;
break;
result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_UNDERLINE), (style->textDecoration() & TextDecorationUnderline) ? "single" : "none");
- result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STYLE), style->font().italic() ? "italic" : "normal");
+ result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STYLE), style->fontCascade().italic() ? "italic" : "normal");
result = addToAtkAttributeSet(result, atk_text_attribute_get_name(ATK_TEXT_ATTR_STRIKETHROUGH), (style->textDecoration() & TextDecorationLineThrough) ? "true" : "false");
#import "AccessibilityTableCell.h"
#import "Chrome.h"
#import "ChromeClient.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "Frame.h"
#import "FrameSelection.h"
#import "FrameView.h"
RenderStyle& style = renderer->style();
// set basic font info
- AXAttributeStringSetFont(attrString, style.font().primaryFontData().getCTFont(), range);
+ AXAttributeStringSetFont(attrString, style.fontCascade().primaryFontData().getCTFont(), range);
int decor = style.textDecorationsInEffect();
if ((decor & (TextDecorationUnderline | TextDecorationLineThrough)) != 0) {
#import "ChromeClient.h"
#import "ColorMac.h"
#import "ContextMenuController.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "Frame.h"
#import "FrameLoaderClient.h"
#import "FrameSelection.h"
#import "ColorMac.h"
#import "ContextMenuController.h"
#import "Editor.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "FrameLoaderClient.h"
#import "FrameSelection.h"
#import "HTMLAnchorElement.h"
const RenderStyle& style = renderer->style();
// set basic font info
- AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.font().primaryFontData().getNSFont(), range);
+ AXAttributeStringSetFont(attrString, NSAccessibilityFontTextAttribute, style.fontCascade().primaryFontData().getNSFont(), range);
// set basic colors
AXAttributeStringSetColor(attrString, NSAccessibilityForegroundColorTextAttribute, nsColor(style.visitedDependentColor(CSSPropertyColor)), range);
#import "DOMPrivate.h"
#import "DOMRangeInternal.h"
#import "DragImage.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "Frame.h"
#import "HTMLElement.h"
#import "HTMLNames.h"
auto renderer = core(self)->renderer();
if (!renderer)
return nil;
- return renderer->style().font().primaryFontData().getNSFont();
+ return renderer->style().fontCascade().primaryFontData().getNSFont();
}
#else
- (CTFontRef)_font
RenderObject* renderer = core(self)->renderer();
if (!renderer)
return nil;
- return renderer->style().font().primaryFontData().getCTFont();
+ return renderer->style().fontCascade().primaryFontData().getCTFont();
}
#endif
#import "DOMNodeInternal.h"
#import "DOMRangeInternal.h"
#import "FloatPoint.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "FrameSelection.h"
#import "HTMLAreaElement.h"
#import "htmlediting.h"
using namespace WebCore;
using WebCore::FloatPoint;
-using WebCore::Font;
+using WebCore::FontCascade;
using WebCore::HTMLAreaElement;
using WebCore::HTMLImageElement;
using WebCore::HTMLSelectElement;
static Ref<CSSValueList> fontFamilyFromStyle(RenderStyle* style)
{
auto list = CSSValueList::createCommaSeparated();
- for (unsigned i = 0; i < style->font().familyCount(); ++i)
- list.get().append(valueForFamily(style->font().familyAt(i)));
+ for (unsigned i = 0; i < style->fontCascade().familyCount(); ++i)
+ list.get().append(valueForFamily(style->fontCascade().familyAt(i)));
return list;
}
case CSSPropertyWordBreak:
return cssValuePool().createValue(style->wordBreak());
case CSSPropertyWordSpacing:
- return zoomAdjustedPixelValue(style->font().wordSpacing(), style.get());
+ return zoomAdjustedPixelValue(style->fontCascade().wordSpacing(), style.get());
case CSSPropertyWordWrap:
return cssValuePool().createValue(style->overflowWrap());
case CSSPropertyWebkitLineBreak:
#include "Color.h"
#include "Counter.h"
#include "ExceptionCode.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "Node.h"
#include "Pair.h"
#include "RGBColor.h"
#include "Dictionary.h"
#include "Document.h"
#include "ExceptionCodeDescription.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "FrameView.h"
#include "StyleProperties.h"
#include "StyleResolver.h"
return adoptRef<LoadFontCallback>(new LoadFontCallback(numLoading, fontLoader, loadCallback, errorCallback));
}
- static PassRefPtr<LoadFontCallback> createFromParams(const Dictionary& params, FontLoader& fontLoader, const Font& font)
+ static PassRefPtr<LoadFontCallback> createFromParams(const Dictionary& params, FontLoader& fontLoader, const FontCascade& font)
{
RefPtr<VoidCallback> onsuccess;
RefPtr<VoidCallback> onerror;
String fontString;
if (!params.get("font", fontString))
return;
- Font font;
+ FontCascade font;
if (!resolveFontStyle(fontString, font))
return;
RefPtr<LoadFontCallback> callback = LoadFontCallback::createFromParams(params, *this, font);
bool FontLoader::checkFont(const String& fontString, const String&)
{
// FIXME: The second parameter (text) is ignored.
- Font font;
+ FontCascade font;
if (!resolveFontStyle(fontString, font))
return false;
for (unsigned i = 0; i < font.familyCount(); i++) {
styleResolver.applyPropertyToCurrentStyle(id, parsedStyle->getPropertyCSSValue(id).get());
}
-bool FontLoader::resolveFontStyle(const String& fontString, Font& font)
+bool FontLoader::resolveFontStyle(const String& fontString, FontCascade& font)
{
// Interpret fontString in the same way as the 'font' attribute of CanvasRenderingContext2D.
RefPtr<MutableStyleProperties> parsedStyle = MutableStyleProperties::create();
style->setFontDescription(defaultFontDescription);
- style->font().update(style->font().fontSelector());
+ style->fontCascade().update(style->fontCascade().fontSelector());
// Now map the font property longhands into the style.
StyleResolver& styleResolver = m_document->ensureStyleResolver();
styleResolver.updateFont();
applyPropertyToCurrentStyle(styleResolver, CSSPropertyLineHeight, parsedStyle);
- font = style->font();
+ font = style->fontCascade();
font.update(styleResolver.fontSelector());
return true;
}
class Dictionary;
class Document;
class Event;
-class Font;
+class FontCascade;
class LoadFontCallback;
class ScriptExecutionContext;
void pendingEventsTimerFired() { firePendingEvents(); }
void scheduleEvent(PassRefPtr<Event>);
void firePendingEvents();
- bool resolveFontStyle(const String&, Font&);
+ bool resolveFontStyle(const String&, FontCascade&);
Document* m_document;
EventTargetData m_eventTargetData;
{
m_ruleSets.appendAuthorStyleSheets(firstNew, styleSheets, m_medium.get(), m_inspectorCSSOMWrappers, this);
if (auto renderView = document().renderView())
- renderView->style().font().update(fontSelector());
+ renderView->style().fontCascade().update(fontSelector());
#if ENABLE(CSS_DEVICE_ADAPTATION)
viewportStyleResolver()->resolve();
if (!s_styleNotYetAvailable) {
s_styleNotYetAvailable = &RenderStyle::create().leakRef();
s_styleNotYetAvailable->setDisplay(NONE);
- s_styleNotYetAvailable->font().update(m_fontSelector);
+ s_styleNotYetAvailable->fontCascade().update(m_fontSelector);
}
element->document().setHasNodesWithPlaceholderStyle();
return *s_styleNotYetAvailable;
// Make sure our fonts are initialized if we don't inherit them from our parent style.
if (Settings* settings = documentSettings()) {
initializeFontStyle(settings);
- m_state.style()->font().update(fontSelector());
+ m_state.style()->fontCascade().update(fontSelector());
} else
- m_state.style()->font().update(0);
+ m_state.style()->fontCascade().update(nullptr);
return m_state.takeStyle();
}
checkForGenericFamilyChange(style, m_state.parentStyle());
checkForZoomChange(style, m_state.parentStyle());
checkForOrientationChange(style);
- style->font().update(m_fontSelector);
+ style->fontCascade().update(m_fontSelector);
if (m_state.fontSizeHasViewportUnits())
style->setHasViewportUnits(true);
m_state.setFontDirty(false);
#include "Document.h"
#include "ExceptionCodePlaceholder.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "Frame.h"
#include "HTMLElement.h"
#include "HTMLNames.h"
// Chinese and Japanese lack word boundary marks, and there is no clear agreement on what constitutes
// a word, so treat the position before any CJK character as a word start.
- if (Font::isCJKIdeographOrSymbol(firstCharacter))
+ if (FontCascade::isCJKIdeographOrSymbol(firstCharacter))
return true;
size_t wordBreakSearchStart = start + length;
#import "DocumentLoader.h"
#import "Element.h"
#import "ElementTraversal.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "Frame.h"
#import "FrameLoader.h"
#import "HTMLElement.h"
auto renderer = element.renderer();
if (!renderer)
return nil;
- return renderer->style().font().primaryFontData().getNSFont();
+ return renderer->style().fontCascade().primaryFontData().getNSFont();
}
#else
static PlatformFont *_font(Element& element)
auto renderer = element.renderer();
if (!renderer)
return nil;
- return (PlatformFont *)renderer->style().font().primaryFontData().getCTFont();
+ return (PlatformFont *)renderer->style().fontCascade().primaryFontData().getCTFont();
}
#endif
[attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSUnderlineStyleAttributeName];
if (style.textDecorationsInEffect() & TextDecorationLineThrough)
[attrs.get() setObject:[NSNumber numberWithInteger:NSUnderlineStyleSingle] forKey:NSStrikethroughStyleAttributeName];
- if (NSFont *font = style.font().primaryFontData().getNSFont())
+ if (NSFont *font = style.fontCascade().primaryFontData().getNSFont())
[attrs.get() setObject:font forKey:NSFontAttributeName];
else
- [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.font().primaryFontData().platformData().size()] forKey:NSFontAttributeName];
+ [attrs.get() setObject:[fontManager convertFont:WebDefaultFont() toSize:style.fontCascade().primaryFontData().platformData().size()] forKey:NSFontAttributeName];
if (style.visitedDependentColor(CSSPropertyColor).alpha())
[attrs.get() setObject:nsColor(style.visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName];
else
#include "DocumentFragment.h"
#include "DocumentLoader.h"
#include "EditorClient.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "Frame.h"
#include "FrameLoaderClient.h"
#include "HTMLConverter.h"
const SimpleFontData* result = nullptr;
if (style)
- result = &style->font().primaryFontData();
+ result = &style->fontCascade().primaryFontData();
if (nodeToRemove) {
ExceptionCode ec;
if (!renderer)
continue;
// FIXME: Are there any node types that have renderers, but that we should be skipping?
- const SimpleFontData& primaryFont = renderer->style().font().primaryFontData();
+ const SimpleFontData& primaryFont = renderer->style().fontCascade().primaryFontData();
if (!font)
font = &primaryFont;
else if (font != &primaryFont) {
NSMutableDictionary* result = [NSMutableDictionary dictionary];
- CTFontRef font = style->font().primaryFontData().getCTFont();
+ CTFontRef font = style->fontCascade().primaryFontData().getCTFont();
if (font)
[result setObject:(id)font forKey:NSFontAttributeName];
#import "DocumentLoader.h"
#import "Editor.h"
#import "EditorClient.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "Frame.h"
#import "FrameLoaderClient.h"
#import "FrameView.h"
const SimpleFontData* result = nullptr;
if (style)
- result = &style->font().primaryFontData();
+ result = &style->fontCascade().primaryFontData();
if (nodeToRemove)
nodeToRemove->remove(ASSERT_NO_EXCEPTION);
if (!renderer)
continue;
// FIXME: Are there any node types that have renderers, but that we should be skipping?
- const SimpleFontData& primaryFont = renderer->style().font().primaryFontData();
+ const SimpleFontData& primaryFont = renderer->style().fontCascade().primaryFontData();
if (!font)
font = &primaryFont;
else if (font != &primaryFont) {
if (style->visitedDependentColor(CSSPropertyBackgroundColor).isValid() && style->visitedDependentColor(CSSPropertyBackgroundColor).alpha() != 0)
[result setObject:nsColor(style->visitedDependentColor(CSSPropertyBackgroundColor)) forKey:NSBackgroundColorAttributeName];
- if (style->font().primaryFontData().getNSFont())
- [result setObject:style->font().primaryFontData().getNSFont() forKey:NSFontAttributeName];
+ if (style->fontCascade().primaryFontData().getNSFont())
+ [result setObject:style->fontCascade().primaryFontData().getNSFont() forKey:NSFontAttributeName];
if (style->visitedDependentColor(CSSPropertyColor).isValid() && style->visitedDependentColor(CSSPropertyColor) != Color::black)
[result setObject:nsColor(style->visitedDependentColor(CSSPropertyColor)) forKey:NSForegroundColorAttributeName];
newStyle->setFontDescription(defaultFontDescription);
}
- newStyle->font().update(newStyle->font().fontSelector());
+ newStyle->fontCascade().update(newStyle->fontCascade().fontSelector());
// Now map the font property longhands into the style.
StyleResolver& styleResolver = canvas()->document().ensureStyleResolver();
styleResolver.updateFont();
styleResolver.applyPropertyToCurrentStyle(CSSPropertyLineHeight, parsedStyle->getPropertyCSSValue(CSSPropertyLineHeight).get());
- modifiableState().m_font = newStyle->font();
+ modifiableState().m_font = newStyle->fontCascade();
modifiableState().m_font.update(styleResolver.fontSelector());
modifiableState().m_realizedFont = true;
styleResolver.fontSelector()->registerForInvalidationCallbacks(&modifiableState());
if (fill && gradient && gradient->isZeroSize())
return;
- const Font& font = accessFont();
+ const FontCascade& font = accessFont();
const FontMetrics& fontMetrics = font.fontMetrics();
String normalizedText = text;
maskImageContext->translate(location.x() - maskRect.x(), location.y() - maskRect.y());
// We draw when fontWidth is 0 so compositing operations (eg, a "copy" op) still work.
maskImageContext->scale(FloatSize((fontWidth > 0 ? (width / fontWidth) : 0), 1));
- maskImageContext->drawBidiText(font, textRun, FloatPoint(0, 0), Font::UseFallbackIfFontNotReady);
+ maskImageContext->drawBidiText(font, textRun, FloatPoint(0, 0), FontCascade::UseFallbackIfFontNotReady);
} else {
maskImageContext->translate(-maskRect.x(), -maskRect.y());
- maskImageContext->drawBidiText(font, textRun, location, Font::UseFallbackIfFontNotReady);
+ maskImageContext->drawBidiText(font, textRun, location, FontCascade::UseFallbackIfFontNotReady);
}
GraphicsContextStateSaver stateSaver(*c);
if (isFullCanvasCompositeMode(state().m_globalComposite)) {
beginCompositeLayer();
- c->drawBidiText(font, textRun, location, Font::UseFallbackIfFontNotReady);
+ c->drawBidiText(font, textRun, location, FontCascade::UseFallbackIfFontNotReady);
endCompositeLayer();
didDrawEntireCanvas();
} else if (state().m_globalComposite == CompositeCopy) {
clearCanvas();
- c->drawBidiText(font, textRun, location, Font::UseFallbackIfFontNotReady);
+ c->drawBidiText(font, textRun, location, FontCascade::UseFallbackIfFontNotReady);
didDrawEntireCanvas();
} else {
- c->drawBidiText(font, textRun, location, Font::UseFallbackIfFontNotReady);
+ c->drawBidiText(font, textRun, location, FontCascade::UseFallbackIfFontNotReady);
didDraw(textRect);
}
}
rect.inflate(delta);
}
-const Font& CanvasRenderingContext2D::accessFont()
+const FontCascade& CanvasRenderingContext2D::accessFont()
{
canvas()->document().updateStyleIfNeeded();
#include "Color.h"
#include "ColorSpace.h"
#include "FloatSize.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "GraphicsTypes.h"
#include "ImageBuffer.h"
#include "Path.h"
Direction m_direction;
String m_unparsedFont;
- Font m_font;
+ FontCascade m_font;
bool m_realizedFont;
};
void drawTextInternal(const String& text, float x, float y, bool fill, float maxWidth = 0, bool useMaxWidth = false);
- const Font& accessFont();
+ const FontCascade& accessFont();
#if ENABLE(DASHBOARD_SUPPORT)
void clearPathForDashboardBackwardCompatibilityMode();
TextRun run(closingBrace.impl(), closingBrace.length());
Node* node = parentNode();
if (node && node->renderer()) {
- const Font& font = node->renderer()->style().font();
+ const FontCascade& font = node->renderer()->style().fontCascade();
padding.appendNumber(font.width(run));
padding.appendLiteral("px");
}
#include "DOMTimer.h"
#include "Database.h"
#include "Document.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "FontGenericFamilies.h"
#include "FrameTree.h"
#include "FrameView.h"
#include "CSSValuePool.h"
#include "Document.h"
-#include "Font.h"
#include "FontCache.h"
+#include "FontCascade.h"
#include "GCController.h"
#include "JSDOMWindow.h"
#include "MemoryCache.h"
#define PopupMenuStyle_h
#include "Color.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "Length.h"
#include "TextDirection.h"
PopupMenuSizeMini
};
- PopupMenuStyle(const Color& foreground, const Color& background, const Font& font, bool visible, bool isDisplayNone, bool hasDefaultAppearance, Length textIndent, TextDirection textDirection, bool hasTextDirectionOverride, BackgroundColorType backgroundColorType = DefaultBackgroundColor, PopupMenuType menuType = SelectPopup, PopupMenuSize menuSize = PopupMenuSizeNormal)
+ PopupMenuStyle(const Color& foreground, const Color& background, const FontCascade& font, bool visible, bool isDisplayNone, bool hasDefaultAppearance, Length textIndent, TextDirection textDirection, bool hasTextDirectionOverride, BackgroundColorType backgroundColorType = DefaultBackgroundColor, PopupMenuType menuType = SelectPopup, PopupMenuSize menuSize = PopupMenuSizeNormal)
: m_foregroundColor(foreground)
, m_backgroundColor(background)
, m_font(font)
const Color& foregroundColor() const { return m_foregroundColor; }
const Color& backgroundColor() const { return m_backgroundColor; }
- const Font& font() const { return m_font; }
+ const FontCascade& font() const { return m_font; }
bool isVisible() const { return m_visible; }
bool isDisplayNone() const { return m_isDisplayNone; }
bool hasDefaultAppearance() const { return m_hasDefaultAppearance; }
private:
Color m_foregroundColor;
Color m_backgroundColor;
- Font m_font;
+ FontCascade m_font;
bool m_visible;
bool m_isDisplayNone;
bool m_hasDefaultAppearance;
namespace WebCore {
-LengthBox Theme::controlBorder(ControlPart part, const Font&, const LengthBox& zoomedBox, float) const
+LengthBox Theme::controlBorder(ControlPart part, const FontCascade&, const LengthBox& zoomedBox, float) const
{
switch (part) {
case PushButtonPart:
}
}
-LengthBox Theme::controlPadding(ControlPart part, const Font&, const LengthBox& zoomedBox, float) const
+LengthBox Theme::controlPadding(ControlPart part, const FontCascade&, const LengthBox& zoomedBox, float) const
{
switch (part) {
case MenulistPart:
#include "Color.h"
#include "ControlStates.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "IntRect.h"
#include "LengthBox.h"
#include "LengthSize.h"
// CSS system colors and fonts
virtual Color systemColor(ThemeColor) const { return Color(); }
- virtual Font systemFont(ThemeFont, FontDescription&) const { return Font(); }
+ virtual FontCascade systemFont(ThemeFont, FontDescription&) const { return FontCascade(); }
// How fast the caret blinks in text fields.
virtual double caretBlinkInterval() const { return 0.5; }
// Methods used to adjust the RenderStyles of controls.
// The font description result should have a zoomed font size.
- virtual FontDescription controlFont(ControlPart, const Font& font, float /*zoomFactor*/) const { return font.fontDescription(); }
+ virtual FontDescription controlFont(ControlPart, const FontCascade& font, float /*zoomFactor*/) const { return font.fontDescription(); }
// The size here is in zoomed coordinates already. If a new size is returned, it also needs to be in zoomed coordinates.
- virtual LengthSize controlSize(ControlPart, const Font&, const LengthSize& zoomedSize, float /*zoomFactor*/) const { return zoomedSize; }
+ virtual LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize& zoomedSize, float /*zoomFactor*/) const { return zoomedSize; }
// Returns the minimum size for a control in zoomed coordinates.
- virtual LengthSize minimumControlSize(ControlPart, const Font&, float /*zoomFactor*/) const { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
+ virtual LengthSize minimumControlSize(ControlPart, const FontCascade&, float /*zoomFactor*/) const { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
// Allows the theme to modify the existing padding/border.
- virtual LengthBox controlPadding(ControlPart, const Font&, const LengthBox& zoomedBox, float zoomFactor) const;
- virtual LengthBox controlBorder(ControlPart, const Font&, const LengthBox& zoomedBox, float zoomFactor) const;
+ virtual LengthBox controlPadding(ControlPart, const FontCascade&, const LengthBox& zoomedBox, float zoomFactor) const;
+ virtual LengthBox controlBorder(ControlPart, const FontCascade&, const LengthBox& zoomedBox, float zoomFactor) const;
// Whether or not whitespace: pre should be forced on always.
virtual bool controlRequiresPreWhiteSpace(ControlPart) const { return false; }
class Cursor;
class Event;
-class Font;
+class FontCascade;
class FrameView;
class GraphicsContext;
class PlatformMouseEvent;
#include "config.h"
#include "FontCache.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "FontGlyphs.h"
#include "FontPlatformData.h"
#include "FontSelector.h"
namespace WebCore {
-class Font;
+class FontCascade;
class FontPlatformData;
class FontSelector;
class OpenTypeVerticalData;
*/
#include "config.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "FloatRect.h"
#include "FontCache.h"
// allow compilation of OwnPtr<TextLayout> in source files that don't have access to the TextLayout class definition
template <> void deleteOwnedPtr<WebCore::TextLayout>(WebCore::TextLayout* ptr)
{
- WebCore::Font::deleteLayout(ptr);
+ WebCore::FontCascade::deleteLayout(ptr);
}
}
static Ref<FontGlyphs> retrieveOrAddCachedFontGlyphs(const FontDescription&, PassRefPtr<FontSelector>);
-const uint8_t Font::s_roundingHackCharacterTable[256] = {
+const uint8_t FontCascade::s_roundingHackCharacterTable[256] = {
0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*\t*/, 1 /*\n*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
1 /*space*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*-*/, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1 /*?*/,
0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
return set->contains(family);
}
-Font::CodePath Font::s_codePath = Auto;
+FontCascade::CodePath FontCascade::s_codePath = Auto;
-TypesettingFeatures Font::s_defaultTypesettingFeatures = 0;
+TypesettingFeatures FontCascade::s_defaultTypesettingFeatures = 0;
// ============================================================================================
-// Font Implementation (Cross-Platform Portion)
+// FontCascade Implementation (Cross-Platform Portion)
// ============================================================================================
-Font::Font()
+FontCascade::FontCascade()
: m_letterSpacing(0)
, m_wordSpacing(0)
, m_useBackslashAsYenSymbol(false)
{
}
-Font::Font(const FontDescription& fd, float letterSpacing, float wordSpacing)
+FontCascade::FontCascade(const FontDescription& fd, float letterSpacing, float wordSpacing)
: m_fontDescription(fd)
, m_letterSpacing(letterSpacing)
, m_wordSpacing(wordSpacing)
}
// FIXME: We should make this constructor platform-independent.
-Font::Font(const FontPlatformData& fontData, bool isPrinterFont, FontSmoothingMode fontSmoothingMode)
+FontCascade::FontCascade(const FontPlatformData& fontData, bool isPrinterFont, FontSmoothingMode fontSmoothingMode)
: m_glyphs(FontGlyphs::createForPlatformFont(fontData))
, m_letterSpacing(0)
, m_wordSpacing(0)
// FIXME: We should make this constructor platform-independent.
#if PLATFORM(IOS)
-Font::Font(const FontPlatformData& fontData, PassRefPtr<FontSelector> fontSelector)
+FontCascade::FontCascade(const FontPlatformData& fontData, PassRefPtr<FontSelector> fontSelector)
: m_glyphs(FontGlyphs::createForPlatformFont(fontData))
, m_letterSpacing(0)
, m_wordSpacing(0)
}
#endif
-Font::Font(const Font& other)
+FontCascade::FontCascade(const FontCascade& other)
: m_fontDescription(other.m_fontDescription)
, m_glyphs(other.m_glyphs)
, m_letterSpacing(other.m_letterSpacing)
{
}
-Font& Font::operator=(const Font& other)
+FontCascade& FontCascade::operator=(const FontCascade& other)
{
m_fontDescription = other.m_fontDescription;
m_glyphs = other.m_glyphs;
return *this;
}
-bool Font::operator==(const Font& other) const
+bool FontCascade::operator==(const FontCascade& other) const
{
if (isLoadingCustomFonts() || other.isLoadingCustomFonts())
return false;
return glyphs;
}
-void Font::update(PassRefPtr<FontSelector> fontSelector) const
+void FontCascade::update(PassRefPtr<FontSelector> fontSelector) const
{
m_glyphs = retrieveOrAddCachedFontGlyphs(m_fontDescription, fontSelector.get());
m_useBackslashAsYenSymbol = useBackslashAsYenSignForFamily(firstFamily());
m_typesettingFeatures = computeTypesettingFeatures();
}
-float Font::drawText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to, CustomFontNotReadyAction customFontNotReadyAction) const
+float FontCascade::drawText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to, 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
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
+void FontCascade::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
{
if (isLoadingCustomFonts())
return;
drawEmphasisMarksForComplexText(context, run, mark, point, from, to);
}
-float Font::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float FontCascade::width(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
{
CodePath codePathToUse = codePath(run);
if (codePathToUse != Complex) {
return result;
}
-float Font::width(const TextRun& run, int& charsConsumed, String& glyphName) const
+float FontCascade::width(const TextRun& run, int& charsConsumed, String& glyphName) const
{
#if ENABLE(SVG_FONTS)
if (isDrawnWithSVGFont(run))
return width(run);
}
-GlyphData Font::glyphDataForCharacter(UChar32 c, bool mirror, FontDataVariant variant) const
+GlyphData FontCascade::glyphDataForCharacter(UChar32 c, bool mirror, FontDataVariant variant) const
{
if (variant == AutoVariant) {
if (m_fontDescription.smallCaps() && !primaryFontData().isSVGFont()) {
}
#if !PLATFORM(COCOA)
-PassOwnPtr<TextLayout> Font::createLayout(RenderText*, float, bool) const
+PassOwnPtr<TextLayout> FontCascade::createLayout(RenderText*, float, bool) const
{
return nullptr;
}
-void Font::deleteLayout(TextLayout*)
+void FontCascade::deleteLayout(TextLayout*)
{
}
-float Font::width(TextLayout&, unsigned, unsigned, HashSet<const SimpleFontData*>*)
+float FontCascade::width(TextLayout&, unsigned, unsigned, HashSet<const SimpleFontData*>*)
{
ASSERT_NOT_REACHED();
return 0;
// from the width of a '0'. This only seems to apply to a fixed number of Mac fonts,
// but, in order to get similar rendering across platforms, we do this check for
// all platforms.
-bool Font::hasValidAverageCharWidth() const
+bool FontCascade::hasValidAverageCharWidth() const
{
AtomicString family = firstFamily();
if (family.isEmpty())
return !fontFamiliesWithInvalidCharWidthMap->contains(family);
}
-bool Font::fastAverageCharWidthIfAvailable(float& width) const
+bool FontCascade::fastAverageCharWidthIfAvailable(float& width) const
{
bool success = hasValidAverageCharWidth();
if (success)
return success;
}
-void Font::adjustSelectionRectForText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
+void FontCascade::adjustSelectionRectForText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
{
to = (to == -1 ? run.length() : to);
return adjustSelectionRectForComplexText(run, selectionRect, from, to);
}
-int Font::offsetForPosition(const TextRun& run, float x, bool includePartialGlyphs) const
+int FontCascade::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() || isDrawnWithSVGFont(run)))
normalized.reserveCapacity(length);
for (unsigned i = 0; i < length; ++i)
- normalized.append(Font::normalizeSpaces(characters[i]));
+ normalized.append(FontCascade::normalizeSpaces(characters[i]));
return normalized.toString();
}
-String Font::normalizeSpaces(const LChar* characters, unsigned length)
+String FontCascade::normalizeSpaces(const LChar* characters, unsigned length)
{
return normalizeSpacesInternal(characters, length);
}
-String Font::normalizeSpaces(const UChar* characters, unsigned length)
+String FontCascade::normalizeSpaces(const UChar* characters, unsigned length)
{
return normalizeSpacesInternal(characters, length);
}
static bool shouldUseFontSmoothing = true;
-void Font::setShouldUseSmoothing(bool shouldUseSmoothing)
+void FontCascade::setShouldUseSmoothing(bool shouldUseSmoothing)
{
ASSERT(isMainThread());
shouldUseFontSmoothing = shouldUseSmoothing;
}
-bool Font::shouldUseSmoothing()
+bool FontCascade::shouldUseSmoothing()
{
return shouldUseFontSmoothing;
}
-void Font::setCodePath(CodePath p)
+void FontCascade::setCodePath(CodePath p)
{
s_codePath = p;
}
-Font::CodePath Font::codePath()
+FontCascade::CodePath FontCascade::codePath()
{
return s_codePath;
}
-void Font::setDefaultTypesettingFeatures(TypesettingFeatures typesettingFeatures)
+void FontCascade::setDefaultTypesettingFeatures(TypesettingFeatures typesettingFeatures)
{
s_defaultTypesettingFeatures = typesettingFeatures;
}
-TypesettingFeatures Font::defaultTypesettingFeatures()
+TypesettingFeatures FontCascade::defaultTypesettingFeatures()
{
return s_defaultTypesettingFeatures;
}
-Font::CodePath Font::codePath(const TextRun& run) const
+FontCascade::CodePath FontCascade::codePath(const TextRun& run) const
{
if (s_codePath != Auto)
return s_codePath;
return characterRangeCodePath(run.characters16(), run.length());
}
-Font::CodePath Font::characterRangeCodePath(const UChar* characters, unsigned len)
+FontCascade::CodePath FontCascade::characterRangeCodePath(const UChar* characters, unsigned len)
{
// FIXME: Should use a UnicodeSet in ports where ICU is used. Note that we
// can't simply use UnicodeCharacter Property/class because some characters
if (c <= 0xA6F1)
return Complex;
- // U+A800 through U+ABFF Nagri, Phags-pa, Saurashtra, Devanagari Extended,
- // Hangul Jamo Ext. A, Javanese, Myanmar Extended A, Tai Viet, Meetei Mayek,
+ // U+A800 through U+ABFF Nagri, Phags-pa, Saurashtra, Devanagari Extended,
+ // Hangul Jamo Ext. A, Javanese, Myanmar Extended A, Tai Viet, Meetei Mayek,
if (c < 0xA800)
continue;
if (c <= 0xABFF)
return result;
}
-bool Font::isCJKIdeograph(UChar32 c)
+bool FontCascade::isCJKIdeograph(UChar32 c)
{
// The basic CJK Unified Ideographs block.
if (c >= 0x4E00 && c <= 0x9FFF)
// CJK Compatibility Ideographs.
if (c >= 0xF900 && c <= 0xFAFF)
return true;
-
+
// CJK Unified Ideographs Extension B.
if (c >= 0x20000 && c <= 0x2A6DF)
return true;
-
+
// CJK Unified Ideographs Extension C.
if (c >= 0x2A700 && c <= 0x2B73F)
return true;
return false;
}
-bool Font::isCJKIdeographOrSymbol(UChar32 c)
+bool FontCascade::isCJKIdeographOrSymbol(UChar32 c)
{
// 0x2C7 Caron, Mandarin Chinese 3rd Tone
// 0x2CA Modifier Letter Acute Accent, Mandarin Chinese 2nd Tone
// Ideographic Description Characters.
if (c >= 0x2FF0 && c <= 0x2FFF)
return true;
-
+
// CJK Symbols and Punctuation, excluding 0x3030.
if (c >= 0x3000 && c < 0x3030)
return true;
// Bopomofo Extended
if (c >= 0x31A0 && c <= 0x31BF)
return true;
-
+
// Enclosed CJK Letters and Months.
if (c >= 0x3200 && c <= 0x32FF)
return true;
return isCJKIdeograph(c);
}
-unsigned Font::expansionOpportunityCountInternal(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion)
+unsigned FontCascade::expansionOpportunityCountInternal(const LChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion)
{
unsigned count = 0;
if (direction == LTR) {
return count;
}
-unsigned Font::expansionOpportunityCountInternal(const UChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion)
+unsigned FontCascade::expansionOpportunityCountInternal(const UChar* characters, size_t length, TextDirection direction, bool& isAfterExpansion)
{
static bool expandAroundIdeographs = canExpandAroundIdeographsInComplexText();
unsigned count = 0;
return count;
}
-unsigned Font::expansionOpportunityCount(const StringView& stringView, TextDirection direction, bool& isAfterExpansion)
+unsigned FontCascade::expansionOpportunityCount(const StringView& stringView, TextDirection direction, bool& isAfterExpansion)
{
if (stringView.is8Bit())
return expansionOpportunityCountInternal(stringView.characters8(), stringView.length(), direction, isAfterExpansion);
return expansionOpportunityCountInternal(stringView.characters16(), stringView.length(), direction, isAfterExpansion);
}
-bool Font::canReceiveTextEmphasis(UChar32 c)
+bool FontCascade::canReceiveTextEmphasis(UChar32 c)
{
if (U_GET_GC_MASK(c) & (U_GC_Z_MASK | U_GC_CN_MASK | U_GC_CC_MASK | U_GC_CF_MASK))
return false;
return true;
}
-bool Font::isLoadingCustomFonts() const
+bool FontCascade::isLoadingCustomFonts() const
{
return m_glyphs && m_glyphs->isLoadingCustomFonts();
}
*
*/
-#ifndef Font_h
-#define Font_h
+#ifndef FontCascade_h
+#define FontCascade_h
#include "DashArray.h"
#include "FontDescription.h"
};
GlyphToPathTranslator::GlyphUnderlineType computeUnderlineType(const TextRun&, const GlyphBuffer&, int index);
-class Font {
+class FontCascade {
public:
- WEBCORE_EXPORT Font();
- WEBCORE_EXPORT Font(const FontDescription&, float letterSpacing, float wordSpacing);
+ WEBCORE_EXPORT FontCascade();
+ WEBCORE_EXPORT FontCascade(const FontDescription&, float letterSpacing, float wordSpacing);
// This constructor is only used if the platform wants to start with a native font.
- WEBCORE_EXPORT Font(const FontPlatformData&, bool isPrinting, FontSmoothingMode = AutoSmoothing);
+ WEBCORE_EXPORT FontCascade(const FontPlatformData&, bool isPrinting, FontSmoothingMode = AutoSmoothing);
// FIXME: We should make this constructor platform-independent.
#if PLATFORM(IOS)
- Font(const FontPlatformData&, PassRefPtr<FontSelector>);
+ FontCascade(const FontPlatformData&, PassRefPtr<FontSelector>);
#endif
- ~Font();
+ ~FontCascade();
- Font(const Font&);
- WEBCORE_EXPORT Font& operator=(const Font&);
+ FontCascade(const FontCascade&);
+ WEBCORE_EXPORT FontCascade& operator=(const FontCascade&);
- WEBCORE_EXPORT bool operator==(const Font& other) const;
- bool operator!=(const Font& other) const { return !(*this == other); }
+ WEBCORE_EXPORT bool operator==(const FontCascade& other) const;
+ bool operator!=(const FontCascade& other) const { return !(*this == other); }
const FontDescription& fontDescription() const { return m_fontDescription; }
public:
#if ENABLE(IOS_TEXT_AUTOSIZING)
- bool equalForTextAutoSizing(const Font& other) const
+ bool equalForTextAutoSizing(const FontCascade& other) const
{
return m_fontDescription.equalForTextAutoSizing(other.m_fontDescription)
&& m_letterSpacing == other.m_letterSpacing
static bool treatAsSpace(UChar c) { return c == ' ' || c == '\t' || c == '\n' || c == noBreakSpace; }
static bool treatAsZeroWidthSpace(UChar c) { return treatAsZeroWidthSpaceInComplexScript(c) || c == 0x200c || c == 0x200d; }
static bool treatAsZeroWidthSpaceInComplexScript(UChar c) { return c < 0x20 || (c >= 0x7F && c < 0xA0) || c == softHyphen || c == zeroWidthSpace || (c >= 0x200e && c <= 0x200f) || (c >= 0x202a && c <= 0x202e) || c == zeroWidthNoBreakSpace || c == objectReplacementCharacter; }
- static bool canReceiveTextEmphasis(UChar32 c);
+ static bool canReceiveTextEmphasis(UChar32);
static inline UChar normalizeSpaces(UChar character)
{
void pruneUnreferencedEntriesFromFontGlyphsCache();
void clearWidthCaches();
-inline Font::~Font()
+inline FontCascade::~FontCascade()
{
}
-inline const SimpleFontData& Font::primaryFontData() const
+inline const SimpleFontData& FontCascade::primaryFontData() const
{
ASSERT(m_glyphs);
return m_glyphs->primarySimpleFontData(m_fontDescription);
}
-inline const FontRanges& Font::fallbackRangesAt(unsigned index) const
+inline const FontRanges& FontCascade::fallbackRangesAt(unsigned index) const
{
ASSERT(m_glyphs);
return m_glyphs->realizeFallbackRangesAt(m_fontDescription, index);
}
-inline bool Font::isFixedPitch() const
+inline bool FontCascade::isFixedPitch() const
{
ASSERT(m_glyphs);
return m_glyphs->isFixedPitch(m_fontDescription);
}
-inline FontSelector* Font::fontSelector() const
+inline FontSelector* FontCascade::fontSelector() const
{
return m_glyphs ? m_glyphs->fontSelector() : 0;
}
-inline float Font::tabWidth(const SimpleFontData& fontData, unsigned tabSize, float position) const
+inline float FontCascade::tabWidth(const SimpleFontData& fontData, unsigned tabSize, float position) const
{
if (!tabSize)
return letterSpacing();
*/
#include "config.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "FloatRect.h"
#include "FontGlyphs.h"
// FIXME: This function may not work if the emphasis mark uses a complex script, but none of the
// standard emphasis marks do so.
-bool Font::getEmphasisMarkGlyphData(const AtomicString& mark, GlyphData& glyphData) const
+bool FontCascade::getEmphasisMarkGlyphData(const AtomicString& mark, GlyphData& glyphData) const
{
if (mark.isEmpty())
return false;
return true;
}
-int Font::emphasisMarkAscent(const AtomicString& mark) const
+int FontCascade::emphasisMarkAscent(const AtomicString& mark) const
{
GlyphData markGlyphData;
if (!getEmphasisMarkGlyphData(mark, markGlyphData))
return markFontData->fontMetrics().ascent();
}
-int Font::emphasisMarkDescent(const AtomicString& mark) const
+int FontCascade::emphasisMarkDescent(const AtomicString& mark) const
{
GlyphData markGlyphData;
if (!getEmphasisMarkGlyphData(mark, markGlyphData))
return markFontData->fontMetrics().descent();
}
-int Font::emphasisMarkHeight(const AtomicString& mark) const
+int FontCascade::emphasisMarkHeight(const AtomicString& mark) const
{
GlyphData markGlyphData;
if (!getEmphasisMarkGlyphData(mark, markGlyphData))
return markFontData->fontMetrics().height();
}
-float Font::getGlyphsAndAdvancesForSimpleText(const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
+float FontCascade::getGlyphsAndAdvancesForSimpleText(const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
{
float initialAdvance;
return initialAdvance;
}
-float Font::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
+float FontCascade::drawSimpleText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
{
// This glyph buffer holds our glyphs+advances+font data for each glyph.
GlyphBuffer glyphBuffer;
return startPoint.x() - startX;
}
-void Font::drawEmphasisMarksForSimpleText(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
+void FontCascade::drawEmphasisMarksForSimpleText(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
{
GlyphBuffer glyphBuffer;
float initialAdvance = getGlyphsAndAdvancesForSimpleText(run, from, to, glyphBuffer, ForTextEmphasis);
drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
}
-void Font::drawGlyphBuffer(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, FloatPoint& point) const
+void FontCascade::drawGlyphBuffer(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, FloatPoint& point) const
{
#if !ENABLE(SVG_FONTS)
UNUSED_PARAM(run);
return offsetToMiddleOfGlyph(glyphBuffer.fontDataAt(i), glyphBuffer.glyphAt(i));
}
-void Font::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point) const
+void FontCascade::drawEmphasisMarks(GraphicsContext* context, const TextRun& run, const GlyphBuffer& glyphBuffer, const AtomicString& mark, const FloatPoint& point) const
{
GlyphData markGlyphData;
if (!getEmphasisMarkGlyphData(mark, markGlyphData))
drawGlyphBuffer(context, run, markBuffer, startPoint);
}
-float Font::floatWidthForSimpleText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float FontCascade::floatWidthForSimpleText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
{
WidthIterator it(this, run, fallbackFonts, glyphOverflow);
GlyphBuffer glyphBuffer;
return it.m_runWidthSoFar;
}
-void Font::adjustSelectionRectForSimpleText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
+void FontCascade::adjustSelectionRectForSimpleText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
{
GlyphBuffer glyphBuffer;
WidthIterator it(this, run);
selectionRect.setWidth(afterWidth - beforeWidth);
}
-int Font::offsetForPositionForSimpleText(const TextRun& run, float x, bool includePartialGlyphs) const
+int FontCascade::offsetForPositionForSimpleText(const TextRun& run, float x, bool includePartialGlyphs) const
{
float delta = x;
#include "config.h"
#include "FontGlyphs.h"
-#include "Font.h"
#include "FontCache.h"
+#include "FontCascade.h"
#include "GlyphPage.h"
namespace WebCore {
if (!systemFallbackFontData)
return GlyphData();
- if (systemFallbackFontData->platformData().orientation() == Vertical && !systemFallbackFontData->hasVerticalGlyphs() && Font::isCJKIdeographOrSymbol(c))
+ if (systemFallbackFontData->platformData().orientation() == Vertical && !systemFallbackFontData->hasVerticalGlyphs() && FontCascade::isCJKIdeographOrSymbol(c))
variant = BrokenIdeographVariant;
GlyphData fallbackGlyphData;
fallbackGlyphData = systemFallbackFontData->variantFontData(description, variant)->glyphDataForCharacter(c);
if (variant == NormalVariant && fallbackGlyphData.fontData) {
- if (!Font::isCJKIdeographOrSymbol(c) && fallbackGlyphData.fontData->platformData().orientation() == Vertical && !fallbackGlyphData.fontData->isTextOrientationFallback())
+ if (!FontCascade::isCJKIdeographOrSymbol(c) && fallbackGlyphData.fontData->platformData().orientation() == Vertical && !fallbackGlyphData.fontData->isTextOrientationFallback())
fallbackGlyphData = glyphDataForNonCJKCharacterWithGlyphOrientation(c, description.nonCJKGlyphOrientation(), fallbackGlyphData);
}
GlyphData data = page->glyphDataForCharacter(c);
if (data.fontData) {
if (data.fontData->platformData().orientation() == Vertical && !data.fontData->isTextOrientationFallback()) {
- if (!Font::isCJKIdeographOrSymbol(c))
+ if (!FontCascade::isCJKIdeographOrSymbol(c))
return glyphDataForNonCJKCharacterWithGlyphOrientation(c, description.nonCJKGlyphOrientation(), data);
if (!data.fontData->hasVerticalGlyphs()) {
// the width of the drawn text. Ensure that there aren't noticeable differences in layout.
#if !PLATFORM(IOS)
#if !USE(WINGDI)
-void GraphicsContext::drawText(const Font& font, const TextRun& run, const FloatPoint& point, int from, int to)
+void GraphicsContext::drawText(const FontCascade& font, const TextRun& run, const FloatPoint& point, int from, int to)
{
if (paintingDisabled())
return;
}
#endif
#else
-float GraphicsContext::drawText(const Font& font, const TextRun& run, const FloatPoint& point, int from, int to)
+float GraphicsContext::drawText(const FontCascade& font, const TextRun& run, const FloatPoint& point, int from, int to)
{
if (paintingDisabled())
return 0;
}
#endif // !PLATFORM(IOS)
-void GraphicsContext::drawGlyphs(const Font& font, const SimpleFontData& fontData, const GlyphBuffer& buffer, int from, int numGlyphs, const FloatPoint& point)
+void GraphicsContext::drawGlyphs(const FontCascade& font, const SimpleFontData& fontData, const GlyphBuffer& buffer, int from, int numGlyphs, const FloatPoint& point)
{
if (paintingDisabled())
return;
font.drawGlyphs(this, &fontData, buffer, from, numGlyphs, point);
}
-void GraphicsContext::drawEmphasisMarks(const Font& font, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to)
+void GraphicsContext::drawEmphasisMarks(const FontCascade& font, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to)
{
if (paintingDisabled())
return;
}
// FIXME: Better merge the iOS and non-iOS differences. In particular, make this method use the
-// returned width of the drawn text, Font::drawText(), instead of computing it. Ensure that there
+// returned width of the drawn text, FontCascade::drawText(), instead of computing it. Ensure that there
// aren't noticeable differences in layout with such a change.
#if !PLATFORM(IOS)
-void GraphicsContext::drawBidiText(const Font& font, const TextRun& run, const FloatPoint& point, Font::CustomFontNotReadyAction customFontNotReadyAction)
+void GraphicsContext::drawBidiText(const FontCascade& font, const TextRun& run, const FloatPoint& point, FontCascade::CustomFontNotReadyAction customFontNotReadyAction)
#else
-float GraphicsContext::drawBidiText(const Font& font, const TextRun& run, const FloatPoint& point, Font::CustomFontNotReadyAction customFontNotReadyAction, BidiStatus* status, int length)
+float GraphicsContext::drawBidiText(const FontCascade& font, const TextRun& run, const FloatPoint& point, FontCascade::CustomFontNotReadyAction customFontNotReadyAction, BidiStatus* status, int length)
#endif
{
if (paintingDisabled())
font.drawText(this, subrun, currPoint, 0, -1, customFontNotReadyAction);
bidiRun = bidiRun->next();
- // FIXME: Have Font::drawText return the width of what it drew so that we don't have to re-measure here.
+ // FIXME: Have FontCascade::drawText return the width of what it drew so that we don't have to re-measure here.
if (bidiRun)
currPoint.move(font.width(subrun), 0);
#else
#include "ColorSpace.h"
#include "DashArray.h"
#include "FloatRect.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "Gradient.h"
#include "Image.h"
#include "ImageOrientation.h"
#endif
#if !PLATFORM(IOS)
- void drawText(const Font&, const TextRun&, const FloatPoint&, int from = 0, int to = -1);
+ void drawText(const FontCascade&, const TextRun&, const FloatPoint&, int from = 0, int to = -1);
#else
- float drawText(const Font&, const TextRun&, const FloatPoint&, int from = 0, int to = -1);
+ float drawText(const FontCascade&, const TextRun&, const FloatPoint&, int from = 0, int to = -1);
#endif
- void drawGlyphs(const Font&, const SimpleFontData&, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&);
- void drawEmphasisMarks(const Font&, const TextRun& , const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1);
+ void drawGlyphs(const FontCascade&, const SimpleFontData&, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&);
+ void drawEmphasisMarks(const FontCascade&, const TextRun& , const AtomicString& mark, const FloatPoint&, int from = 0, int to = -1);
#if !PLATFORM(IOS)
- void drawBidiText(const Font&, const TextRun&, const FloatPoint&, Font::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady);
+ void drawBidiText(const FontCascade&, const TextRun&, const FloatPoint&, FontCascade::CustomFontNotReadyAction = FontCascade::DoNotPaintIfFontNotReady);
#else
- WEBCORE_EXPORT float drawBidiText(const Font&, const TextRun&, const FloatPoint&, Font::CustomFontNotReadyAction = Font::DoNotPaintIfFontNotReady, BidiStatus* = 0, int length = -1);
+ WEBCORE_EXPORT float drawBidiText(const FontCascade&, const TextRun&, const FloatPoint&, FontCascade::CustomFontNotReadyAction = FontCascade::DoNotPaintIfFontNotReady, BidiStatus* = 0, int length = -1);
#endif
enum RoundingMode {
RoundAllSides,
#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080)
#include "CoreTextSPI.h"
#endif
-#include "Font.h"
#include "FontCache.h"
+#include "FontCascade.h"
#include "OpenTypeMathData.h"
#include <wtf/MathExtras.h>
#include <wtf/NeverDestroyed.h>
UChar codeUnits[2];
int codeUnitsLength;
if (U_IS_BMP(character)) {
- codeUnits[0] = Font::normalizeSpaces(character);
+ codeUnits[0] = FontCascade::normalizeSpaces(character);
codeUnitsLength = 1;
} else {
codeUnits[0] = U16_LEAD(character);
#include "config.h"
#include "StringTruncator.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "TextBreakIterator.h"
#include "TextRun.h"
#include <wtf/Assertions.h>
return length - adjustedStartIndex;
}
-static float stringWidth(const Font& renderer, const UChar* characters, unsigned length, bool disableRoundingHacks)
+static float stringWidth(const FontCascade& renderer, const UChar* characters, unsigned length, bool disableRoundingHacks)
{
TextRun run(characters, length);
if (disableRoundingHacks)
return renderer.width(run);
}
-static String truncateString(const String& string, float maxWidth, const Font& font, TruncationFunction truncateToBuffer, bool disableRoundingHacks, float* resultWidth = nullptr, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0, bool alwaysTruncate = false)
+static String truncateString(const String& string, float maxWidth, const FontCascade& font, TruncationFunction truncateToBuffer, bool disableRoundingHacks, float* resultWidth = nullptr, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0, bool alwaysTruncate = false)
{
if (string.isEmpty())
return string;
return String(stringBuffer, truncatedLength);
}
-String StringTruncator::centerTruncate(const String& string, float maxWidth, const Font& font, EnableRoundingHacksOrNot enableRoundingHacks)
+String StringTruncator::centerTruncate(const String& string, float maxWidth, const FontCascade& font, EnableRoundingHacksOrNot enableRoundingHacks)
{
return truncateString(string, maxWidth, font, centerTruncateToBuffer, !enableRoundingHacks);
}
-String StringTruncator::rightTruncate(const String& string, float maxWidth, const Font& font, EnableRoundingHacksOrNot enableRoundingHacks)
+String StringTruncator::rightTruncate(const String& string, float maxWidth, const FontCascade& font, EnableRoundingHacksOrNot enableRoundingHacks)
{
return truncateString(string, maxWidth, font, rightTruncateToBuffer, !enableRoundingHacks);
}
-float StringTruncator::width(const String& string, const Font& font, EnableRoundingHacksOrNot enableRoundingHacks)
+float StringTruncator::width(const String& string, const FontCascade& font, EnableRoundingHacksOrNot enableRoundingHacks)
{
return stringWidth(font, StringView(string).upconvertedCharacters(), string.length(), !enableRoundingHacks);
}
-String StringTruncator::centerTruncate(const String& string, float maxWidth, const Font& font, EnableRoundingHacksOrNot enableRoundingHacks, float& resultWidth, bool shouldInsertEllipsis, float customTruncationElementWidth)
+String StringTruncator::centerTruncate(const String& string, float maxWidth, const FontCascade& font, EnableRoundingHacksOrNot enableRoundingHacks, float& resultWidth, bool shouldInsertEllipsis, float customTruncationElementWidth)
{
return truncateString(string, maxWidth, font, centerTruncateToBuffer, !enableRoundingHacks, &resultWidth, shouldInsertEllipsis, customTruncationElementWidth);
}
-String StringTruncator::rightTruncate(const String& string, float maxWidth, const Font& font, EnableRoundingHacksOrNot enableRoundingHacks, float& resultWidth, bool shouldInsertEllipsis, float customTruncationElementWidth)
+String StringTruncator::rightTruncate(const String& string, float maxWidth, const FontCascade& font, EnableRoundingHacksOrNot enableRoundingHacks, float& resultWidth, bool shouldInsertEllipsis, float customTruncationElementWidth)
{
return truncateString(string, maxWidth, font, rightTruncateToBuffer, !enableRoundingHacks, &resultWidth, shouldInsertEllipsis, customTruncationElementWidth);
}
-String StringTruncator::leftTruncate(const String& string, float maxWidth, const Font& font, EnableRoundingHacksOrNot enableRoundingHacks, float& resultWidth, bool shouldInsertEllipsis, float customTruncationElementWidth)
+String StringTruncator::leftTruncate(const String& string, float maxWidth, const FontCascade& font, EnableRoundingHacksOrNot enableRoundingHacks, float& resultWidth, bool shouldInsertEllipsis, float customTruncationElementWidth)
{
return truncateString(string, maxWidth, font, leftTruncateToBuffer, !enableRoundingHacks, &resultWidth, shouldInsertEllipsis, customTruncationElementWidth);
}
-String StringTruncator::rightClipToCharacter(const String& string, float maxWidth, const Font& font, EnableRoundingHacksOrNot enableRoundingHacks, float& resultWidth, bool shouldInsertEllipsis, float customTruncationElementWidth)
+String StringTruncator::rightClipToCharacter(const String& string, float maxWidth, const FontCascade& font, EnableRoundingHacksOrNot enableRoundingHacks, float& resultWidth, bool shouldInsertEllipsis, float customTruncationElementWidth)
{
return truncateString(string, maxWidth, font, rightClipToCharacterBuffer, !enableRoundingHacks, &resultWidth, shouldInsertEllipsis, customTruncationElementWidth);
}
-String StringTruncator::rightClipToWord(const String& string, float maxWidth, const Font& font, EnableRoundingHacksOrNot enableRoundingHacks, float& resultWidth, bool shouldInsertEllipsis, float customTruncationElementWidth, bool alwaysTruncate)
+String StringTruncator::rightClipToWord(const String& string, float maxWidth, const FontCascade& font, EnableRoundingHacksOrNot enableRoundingHacks, float& resultWidth, bool shouldInsertEllipsis, float customTruncationElementWidth, bool alwaysTruncate)
{
return truncateString(string, maxWidth, font, rightClipToWordBuffer, !enableRoundingHacks, &resultWidth, shouldInsertEllipsis, customTruncationElementWidth, alwaysTruncate);
}
namespace WebCore {
- class Font;
-
- class StringTruncator {
- public:
- enum EnableRoundingHacksOrNot { DisableRoundingHacks, EnableRoundingHacks };
+class FontCascade;
+
+class StringTruncator {
+public:
+ enum EnableRoundingHacksOrNot { DisableRoundingHacks, EnableRoundingHacks };
- WEBCORE_EXPORT static String centerTruncate(const String&, float maxWidth, const Font&, EnableRoundingHacksOrNot = DisableRoundingHacks);
- WEBCORE_EXPORT static String rightTruncate(const String&, float maxWidth, const Font&, EnableRoundingHacksOrNot = DisableRoundingHacks);
+ WEBCORE_EXPORT static String centerTruncate(const String&, float maxWidth, const FontCascade&, EnableRoundingHacksOrNot = DisableRoundingHacks);
+ WEBCORE_EXPORT static String rightTruncate(const String&, float maxWidth, const FontCascade&, EnableRoundingHacksOrNot = DisableRoundingHacks);
- WEBCORE_EXPORT static String centerTruncate(const String&, float maxWidth, const Font&, EnableRoundingHacksOrNot, float& resultWidth, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0);
- WEBCORE_EXPORT static String rightTruncate(const String&, float maxWidth, const Font&, EnableRoundingHacksOrNot, float& resultWidth, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0);
- WEBCORE_EXPORT static String leftTruncate(const String&, float maxWidth, const Font&, EnableRoundingHacksOrNot, float& resultWidth, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0);
- WEBCORE_EXPORT static String rightClipToCharacter(const String&, float maxWidth, const Font&, EnableRoundingHacksOrNot, float& resultWidth, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0);
- WEBCORE_EXPORT static String rightClipToWord(const String&, float maxWidth, const Font&, EnableRoundingHacksOrNot, float& resultWidth, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0, bool alwaysTruncate = false);
+ WEBCORE_EXPORT static String centerTruncate(const String&, float maxWidth, const FontCascade&, EnableRoundingHacksOrNot, float& resultWidth, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0);
+ WEBCORE_EXPORT static String rightTruncate(const String&, float maxWidth, const FontCascade&, EnableRoundingHacksOrNot, float& resultWidth, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0);
+ WEBCORE_EXPORT static String leftTruncate(const String&, float maxWidth, const FontCascade&, EnableRoundingHacksOrNot, float& resultWidth, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0);
+ WEBCORE_EXPORT static String rightClipToCharacter(const String&, float maxWidth, const FontCascade&, EnableRoundingHacksOrNot, float& resultWidth, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0);
+ WEBCORE_EXPORT static String rightClipToWord(const String&, float maxWidth, const FontCascade&, EnableRoundingHacksOrNot, float& resultWidth, bool shouldInsertEllipsis = true, float customTruncationElementWidth = 0, bool alwaysTruncate = false);
- WEBCORE_EXPORT static float width(const String&, const Font&, EnableRoundingHacksOrNot = DisableRoundingHacks);
- };
+ WEBCORE_EXPORT static float width(const String&, const FontCascade&, EnableRoundingHacksOrNot = DisableRoundingHacks);
+};
} // namespace WebCore
class FloatPoint;
class FloatRect;
-class Font;
+class FontCascade;
class GraphicsContext;
class GlyphBuffer;
class GlyphToPathTranslator;
virtual ~RenderingContext() { }
#if ENABLE(SVG_FONTS)
- virtual GlyphData glyphDataForCharacter(const Font&, WidthIterator&, UChar32 character, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) = 0;
+ virtual GlyphData glyphDataForCharacter(const FontCascade&, WidthIterator&, UChar32 character, bool mirror, int currentCharacter, unsigned& advanceLength, String& normalizedSpacesStringCache) = 0;
virtual void drawSVGGlyphs(GraphicsContext*, const SimpleFontData*, const GlyphBuffer&, int from, int to, const FloatPoint&) const = 0;
- virtual float floatWidthUsingSVGFont(const Font&, const TextRun&, int& charsConsumed, String& glyphName) const = 0;
+ virtual float floatWidthUsingSVGFont(const FontCascade&, const TextRun&, int& charsConsumed, String& glyphName) const = 0;
virtual bool applySVGKerning(const SimpleFontData*, WidthIterator&, GlyphBuffer*, int from) const = 0;
virtual std::unique_ptr<GlyphToPathTranslator> createGlyphToPathTranslator(const SimpleFontData&, const TextRun*, const GlyphBuffer&, int from, int numGlyphs, const FloatPoint&) const = 0;
#endif
#include "config.h"
#include "WidthIterator.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "GlyphBuffer.h"
#include "Latin1TextIterator.h"
#include "SimpleFontData.h"
namespace WebCore {
-WidthIterator::WidthIterator(const Font* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, bool accountForGlyphBounds, bool forTextEmphasis)
+WidthIterator::WidthIterator(const FontCascade* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, bool accountForGlyphBounds, bool forTextEmphasis)
: m_font(font)
, m_run(run)
, m_currentCharacter(0)
m_expansionPerOpportunity = 0;
else {
bool isAfterExpansion = m_isAfterExpansion;
- unsigned expansionOpportunityCount = Font::expansionOpportunityCount(m_run.text(), m_run.ltr() ? LTR : RTL, isAfterExpansion);
+ unsigned expansionOpportunityCount = FontCascade::expansionOpportunityCount(m_run.text(), m_run.ltr() ? LTR : RTL, isAfterExpansion);
if (isAfterExpansion && !m_run.allowsTrailingExpansion())
expansionOpportunityCount--;
if (width && m_font->letterSpacing())
width += m_font->letterSpacing();
- static bool expandAroundIdeographs = Font::canExpandAroundIdeographsInComplexText();
- bool treatAsSpace = Font::treatAsSpace(character);
- if (treatAsSpace || (expandAroundIdeographs && Font::isCJKIdeographOrSymbol(character))) {
+ static bool expandAroundIdeographs = FontCascade::canExpandAroundIdeographsInComplexText();
+ bool treatAsSpace = FontCascade::treatAsSpace(character);
+ if (treatAsSpace || (expandAroundIdeographs && FontCascade::isCJKIdeographOrSymbol(character))) {
// Distribute the run's total expansion evenly over all expansion opportunities in the run.
if (m_expansion) {
float previousExpansion = m_expansion;
m_isAfterExpansion = false;
}
- if (shouldApplyFontTransforms() && glyphBuffer && Font::treatAsSpace(character))
+ if (shouldApplyFontTransforms() && glyphBuffer && FontCascade::treatAsSpace(character)) {
charactersTreatedAsSpace.append(std::make_pair(glyphBuffer->size(),
OriginalAdvancesForCharacterTreatedAsSpace(character == ' ', glyphBuffer->size() ? glyphBuffer->advanceAt(glyphBuffer->size() - 1).width() : 0, width)));
+ }
if (m_accountForGlyphBounds) {
bounds = fontData->boundsForGlyph(glyph);
m_firstGlyphOverflow = std::max<float>(0, -bounds.x());
}
- if (m_forTextEmphasis && !Font::canReceiveTextEmphasis(character))
+ if (m_forTextEmphasis && !FontCascade::canReceiveTextEmphasis(character))
glyph = 0;
// Advance past the character we just dealt with.
// Force characters that are used to determine word boundaries for the rounding hack
// to be integer width, so following words will start on an integer boundary.
- if (m_run.applyWordRounding() && Font::isRoundingHackCharacter(character)) {
+ if (m_run.applyWordRounding() && FontCascade::isRoundingHackCharacter(character)) {
width = ceilf(width);
// Since widthSinceLastRounding can lose precision if we include measurements for
} else {
// Check to see if the next character is a "rounding hack character", if so, adjust
// width so that the total run width will be on an integer boundary.
- if ((m_run.applyWordRounding() && static_cast<unsigned>(textIterator.currentCharacter()) < m_run.length() && Font::isRoundingHackCharacter(*(textIterator.characters())))
+ if ((m_run.applyWordRounding() && static_cast<unsigned>(textIterator.currentCharacter()) < m_run.length() && FontCascade::isRoundingHackCharacter(*(textIterator.characters())))
|| (m_run.applyRunRounding() && static_cast<unsigned>(textIterator.currentCharacter()) >= m_run.length())) {
float totalWidth = widthSinceLastRounding + width;
widthSinceLastRounding = ceilf(totalWidth);
#ifndef WidthIterator_h
#define WidthIterator_h
-#include "Font.h"
+#include "FontCascade.h"
#include "SVGGlyph.h"
#include "TextRun.h"
#include <wtf/HashSet.h>
namespace WebCore {
-class Font;
+class FontCascade;
class GlyphBuffer;
class SimpleFontData;
class TextRun;
struct WidthIterator {
WTF_MAKE_FAST_ALLOCATED;
public:
- WidthIterator(const Font*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool accountForGlyphBounds = false, bool forTextEmphasis = false);
+ WidthIterator(const FontCascade*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool accountForGlyphBounds = false, bool forTextEmphasis = false);
unsigned advance(int to, GlyphBuffer*);
bool advanceOneCharacter(float& width, GlyphBuffer&);
Vector<SVGGlyph::ArabicForm>& arabicForms() { return m_arabicForms; }
#endif
- static bool supportsTypesettingFeatures(const Font& font)
+ static bool supportsTypesettingFeatures(const FontCascade& font)
{
#if PLATFORM(IOS) || (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED > 1080)
if (!font.isPrinterFont())
#endif
}
- const Font* m_font;
+ const FontCascade* m_font;
const TextRun& m_run;
*/
#include "config.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "AffineTransform.h"
#include "CairoUtilities.h"
}
}
-void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
+void FontCascade::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
int from, int numGlyphs, const FloatPoint& point) const
{
if (!font->platformData().size())
} while (m_fontData->isSVGFont() && m_index < m_glyphBuffer.size());
}
-DashArray Font::dashesForIntersectionsWithRect(const TextRun& run, const FloatPoint& textOrigin, const FloatRect& lineExtents) const
+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) != Font::Complex)
+ if (codePath(run) != FontCascade::Complex)
deltaX = getGlyphsAndAdvancesForSimpleText(run, 0, run.length(), glyphBuffer);
else
deltaX = getGlyphsAndAdvancesForComplexText(run, 0, run.length(), glyphBuffer);
*/
#include "config.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "GraphicsContext.h"
#include "HarfBuzzShaper.h"
namespace WebCore {
-float Font::getGlyphsAndAdvancesForComplexText(const TextRun& run, int, int, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot /* forTextEmphasis */) const
+float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, int, int, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot /* forTextEmphasis */) const
{
HarfBuzzShaper shaper(this, run);
if (!shaper.shape(&glyphBuffer)) {
// FIXME: Mac returns an initial advance here.
return 0;
}
-float Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
+float FontCascade::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
{
// This glyph buffer holds our glyphs + advances + font data for each glyph.
GlyphBuffer glyphBuffer;
return startPoint.x() - startX;
}
-void Font::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, int /* from */, int /* to */) const
+void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext* /* context */, const TextRun& /* run */, const AtomicString& /* mark */, const FloatPoint& /* point */, int /* from */, int /* to */) const
{
notImplemented();
}
-bool Font::canReturnFallbackFontsForComplexText()
+bool FontCascade::canReturnFallbackFontsForComplexText()
{
return false;
}
-bool Font::canExpandAroundIdeographsInComplexText()
+bool FontCascade::canExpandAroundIdeographsInComplexText()
{
return false;
}
-float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const
+float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>*, GlyphOverflow*) const
{
HarfBuzzShaper shaper(this, run);
if (shaper.shape())
return 0;
}
-int Font::offsetForPositionForComplexText(const TextRun& run, float x, bool) const
+int FontCascade::offsetForPositionForComplexText(const TextRun& run, float x, bool) const
{
HarfBuzzShaper shaper(this, run);
if (shaper.shape())
return 0;
}
-void Font::adjustSelectionRectForComplexText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
+void FontCascade::adjustSelectionRectForComplexText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
{
HarfBuzzShaper shaper(this, run);
if (shaper.shape()) {
#include "config.h"
#include "FontCache.h"
-#include "Font.h"
#include "OwnPtrCairo.h"
#include "RefPtrCairo.h"
#include "SimpleFontData.h"
#include "FloatConversion.h"
#include "FloatRect.h"
-#include "Font.h"
#include "FontCache.h"
#include "FontDescription.h"
#include "GlyphBuffer.h"
#include "config.h"
#include "HarfBuzzShaper.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "HarfBuzzFace.h"
#include "SurrogatePairAwareTextIterator.h"
#include <hb-icu.h>
int nextPosition = position;
U16_NEXT(source, nextPosition, length, character);
// Don't normalize tabs as they are not treated as spaces for word-end.
- if (Font::treatAsSpace(character) && character != '\t')
+ if (FontCascade::treatAsSpace(character) && character != '\t')
character = ' ';
- else if (Font::treatAsZeroWidthSpaceInComplexScript(character))
+ else if (FontCascade::treatAsZeroWidthSpaceInComplexScript(character))
character = zeroWidthSpace;
U16_APPEND(destination, position, length, character, error);
ASSERT_UNUSED(error, !error);
}
}
-HarfBuzzShaper::HarfBuzzShaper(const Font* font, const TextRun& run)
+HarfBuzzShaper::HarfBuzzShaper(const FontCascade* font, const TextRun& run)
: m_font(font)
, m_normalizedBufferLength(0)
, m_run(run)
int nextPosition = position;
U16_NEXT(source, nextPosition, length, character);
// Don't normalize tabs as they are not treated as spaces for word-end
- if (Font::treatAsSpace(character) && character != '\t')
+ if (FontCascade::treatAsSpace(character) && character != '\t')
character = ' ';
- else if (Font::treatAsZeroWidthSpace(character))
+ else if (FontCascade::treatAsZeroWidthSpace(character))
character = zeroWidthSpace;
else if (normalizeMode == HarfBuzzShaper::NormalizeMirrorChars)
character = u_charMirror(character);
UScriptCode currentScript = nextScript;
for (iterator.advance(clusterLength); iterator.consume(character, clusterLength); iterator.advance(clusterLength)) {
- if (Font::treatAsZeroWidthSpace(character))
+ if (FontCascade::treatAsZeroWidthSpace(character))
continue;
if (U_GET_GC_MASK(character) & U_GC_M_MASK) {
glyphToCharacterIndexes[i] = glyphInfos[i].cluster;
- if (isClusterEnd && !Font::treatAsZeroWidthSpace(m_normalizedBuffer[currentCharacterIndex]))
+ if (isClusterEnd && !FontCascade::treatAsZeroWidthSpace(m_normalizedBuffer[currentCharacterIndex]))
spacing += m_letterSpacing;
if (isClusterEnd && isWordEnd(currentCharacterIndex))
namespace WebCore {
-class Font;
+class FontCascade;
class SimpleFontData;
class HarfBuzzShaper {
NormalizeMirrorChars
};
- HarfBuzzShaper(const Font*, const TextRun&);
+ HarfBuzzShaper(const FontCascade*, const TextRun&);
virtual ~HarfBuzzShaper();
bool shape(GlyphBuffer* = 0);
GlyphBufferAdvance createGlyphBufferAdvance(float, float);
- const Font* m_font;
+ const FontCascade* m_font;
std::unique_ptr<UChar[]> m_normalizedBuffer;
unsigned m_normalizedBufferLength;
const TextRun& m_run;
#import "CoreGraphicsSPI.h"
#import "CoreTextSPI.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "RenderThemeIOS.h"
#import <wtf/NeverDestroyed.h>
#import <wtf/RetainPtr.h>
#import "BlockExceptions.h"
#import "CoreGraphicsSPI.h"
-#import "Font.h"
#import "FontCache.h"
+#import "FontCascade.h"
#import "FontDescription.h"
#import "FontServicesIOS.h"
#import <CoreText/CoreText.h>
#include "ComplexTextController.h"
#include "FloatSize.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "RenderBlock.h"
#include "RenderText.h"
#include "TextBreakIterator.h"
class TextLayout {
public:
- static bool isNeeded(RenderText* text, const Font& font)
+ static bool isNeeded(RenderText* text, const FontCascade& font)
{
TextRun run = RenderBlock::constructTextRun(text, font, text, text->style());
- return font.codePath(run) == Font::Complex;
+ return font.codePath(run) == FontCascade::Complex;
}
- TextLayout(RenderText* text, const Font& font, float xPos)
+ TextLayout(RenderText* text, const FontCascade& font, float xPos)
: m_font(font)
, m_run(constructTextRun(text, font, xPos))
, m_controller(std::make_unique<ComplexTextController>(&m_font, m_run, true))
{
m_controller->advance(from, 0, ByWholeGlyphs, fallbackFonts);
float beforeWidth = m_controller->runWidthSoFar();
- if (m_font.wordSpacing() && from && Font::treatAsSpace(m_run[from]))
+ if (m_font.wordSpacing() && from && FontCascade::treatAsSpace(m_run[from]))
beforeWidth += m_font.wordSpacing();
m_controller->advance(from + len, 0, ByWholeGlyphs, fallbackFonts);
float afterWidth = m_controller->runWidthSoFar();
}
private:
- static TextRun constructTextRun(RenderText* text, const Font& font, float xPos)
+ static TextRun constructTextRun(RenderText* text, const FontCascade& font, float xPos)
{
TextRun run = RenderBlock::constructTextRun(text, font, text, text->style());
run.setCharactersLength(text->textLength());
return run;
}
- // ComplexTextController has only references to its Font and TextRun so they must be kept alive here.
- Font m_font;
+ // ComplexTextController has only references to its FontCascade and TextRun so they must be kept alive here.
+ FontCascade m_font;
TextRun m_run;
std::unique_ptr<ComplexTextController> m_controller;
};
-PassOwnPtr<TextLayout> Font::createLayout(RenderText* text, float xPos, bool collapseWhiteSpace) const
+PassOwnPtr<TextLayout> FontCascade::createLayout(RenderText* text, float xPos, bool collapseWhiteSpace) const
{
if (!collapseWhiteSpace || !TextLayout::isNeeded(text, *this))
return nullptr;
return adoptPtr(new TextLayout(text, *this, xPos));
}
-void Font::deleteLayout(TextLayout* layout)
+void FontCascade::deleteLayout(TextLayout* layout)
{
delete layout;
}
-float Font::width(TextLayout& layout, unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts)
+float FontCascade::width(TextLayout& layout, unsigned from, unsigned len, HashSet<const SimpleFontData*>* fallbackFonts)
{
return layout.width(from, len, fallbackFonts);
}
return static_cast<CGFloat>(ceil(f));
}
-ComplexTextController::ComplexTextController(const Font* font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const SimpleFontData*>* fallbackFonts, bool forTextEmphasis)
+ComplexTextController::ComplexTextController(const FontCascade* font, const TextRun& run, bool mayUseNaturalWritingDirection, HashSet<const SimpleFontData*>* fallbackFonts, bool forTextEmphasis)
: m_font(*font)
, m_run(run)
, m_isLTROnly(true)
m_expansionPerOpportunity = 0;
else {
bool isAfterExpansion = m_afterExpansion;
- unsigned expansionOpportunityCount = Font::expansionOpportunityCount(m_run.text(), m_run.ltr() ? LTR : RTL, isAfterExpansion);
+ unsigned expansionOpportunityCount = FontCascade::expansionOpportunityCount(m_run.text(), m_run.ltr() ? LTR : RTL, isAfterExpansion);
if (isAfterExpansion && !m_run.allowsTrailingExpansion())
expansionOpportunityCount--;
else
nextCh = *(m_complexTextRuns[r + 1]->characters() + m_complexTextRuns[r + 1]->indexAt(0));
- bool treatAsSpace = Font::treatAsSpace(ch);
+ bool treatAsSpace = FontCascade::treatAsSpace(ch);
CGGlyph glyph = treatAsSpace ? fontData.spaceGlyph() : glyphs[i];
CGSize advance = treatAsSpace ? CGSizeMake(spaceWidth, advances[i].height) : advances[i];
#if PLATFORM(IOS)
if (ch == '\t' && m_run.allowTabs())
advance.width = m_font.tabWidth(fontData, m_run.tabSize(), m_run.xPos() + m_totalWidth + widthSinceLastCommit);
- else if (Font::treatAsZeroWidthSpace(ch) && !treatAsSpace) {
+ else if (FontCascade::treatAsZeroWidthSpace(ch) && !treatAsSpace) {
advance.width = 0;
glyph = fontData.spaceGlyph();
}
advance.width += m_font.letterSpacing();
// Handle justification and word-spacing.
- if (treatAsSpace || Font::isCJKIdeographOrSymbol(ch)) {
+ if (treatAsSpace || FontCascade::isCJKIdeographOrSymbol(ch)) {
// Distribute the run's total expansion evenly over all expansion opportunities in the run.
if (m_expansion) {
float previousExpansion = m_expansion;
// We adjust the width of the last character of a "word" to ensure an integer width.
// Force characters that are used to determine word boundaries for the rounding hack
// to be integer width, so the following words will start on an integer boundary.
- if (m_run.applyWordRounding() && Font::isRoundingHackCharacter(ch))
+ if (m_run.applyWordRounding() && FontCascade::isRoundingHackCharacter(ch))
advance.width = ceilCGFloat(advance.width);
// Check to see if the next character is a "rounding hack character", if so, adjust the
- // width so that the total run width will be on an integer boundary.
- if ((m_run.applyWordRounding() && !lastGlyph && Font::isRoundingHackCharacter(nextCh)) || (m_run.applyRunRounding() && lastGlyph)) {
+ // width so that the total run width will be on an integer boundary.
+ bool needsRoundingForCharacter = m_run.applyWordRounding() && !lastGlyph && FontCascade::isRoundingHackCharacter(nextCh);
+ if (needsRoundingForCharacter || (m_run.applyRunRounding() && lastGlyph)) {
CGFloat totalWidth = widthSinceLastCommit + advance.width;
widthSinceLastCommit = ceilCGFloat(totalWidth);
CGFloat extraWidth = widthSinceLastCommit - totalWidth;
widthSinceLastCommit += advance.width;
// FIXME: Combining marks should receive a text emphasis mark if they are combine with a space.
- if (m_forTextEmphasis && (!Font::canReceiveTextEmphasis(ch) || (U_GET_GC_MASK(ch) & U_GC_M_MASK)))
+ if (m_forTextEmphasis && (!FontCascade::canReceiveTextEmphasis(ch) || (U_GET_GC_MASK(ch) & U_GC_M_MASK)))
glyph = 0;
advance.height *= -1;
namespace WebCore {
-class Font;
+class FontCascade;
class SimpleFontData;
class TextRun;
// complex scripts on OS X.
class ComplexTextController {
public:
- ComplexTextController(const Font*, const TextRun&, bool mayUseNaturalWritingDirection = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool forTextEmphasis = false);
+ ComplexTextController(const FontCascade*, const TextRun&, bool mayUseNaturalWritingDirection = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, bool forTextEmphasis = false);
// Advance and emit glyphs up to the specified character.
void advance(unsigned to, GlyphBuffer* = 0, GlyphIterationStyle = IncludePartialGlyphs, HashSet<const SimpleFontData*>* fallbackFonts = 0);
Vector<unsigned, 16> m_runIndices;
Vector<unsigned, 16> m_glyphCountFromStartToIndex;
- const Font& m_font;
+ const FontCascade& m_font;
const TextRun& m_run;
bool m_isLTROnly;
bool m_mayUseNaturalWritingDirection;
#include "ComplexTextController.h"
#include "CoreTextSPI.h"
-#include "Font.h"
#include "FontCache.h"
+#include "FontCascade.h"
#include "TextRun.h"
#include "WebCoreSystemInterface.h"
@interface WebCascadeList : NSArray {
@private
- const WebCore::Font* _font;
+ const WebCore::FontCascade* _font;
UChar32 _character;
NSUInteger _count;
Vector<RetainPtr<CTFontDescriptorRef>, 16> _fontDescriptors;
}
-- (id)initWithFont:(const WebCore::Font*)font character:(UChar32)character;
+- (id)initWithFont:(const WebCore::FontCascade*)font character:(UChar32)character;
@end
@implementation WebCascadeList
-- (id)initWithFont:(const WebCore::Font*)font character:(UChar32)character
+- (id)initWithFont:(const WebCore::FontCascade*)font character:(UChar32)character
{
if (!(self = [super init]))
return nil;
_font = font;
_character = character;
- // By the time a WebCascadeList is used, the Font has already been asked to realize all of its
+ // By the time a WebCascadeList is used, the FontCascade has already been asked to realize all of its
// FontData, so this loop does not hit the FontCache.
while (!_font->fallbackRangesAt(_count).isNull())
_count++;
#if !PLATFORM(IOS)
#import "CoreGraphicsSPI.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "SimpleFontData.h"
#import "FontPlatformData.h"
#import "NSFontSPI.h"
*/
#include "config.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "ComplexTextController.h"
#include "FontGlyphs.h"
namespace WebCore {
-void Font::adjustSelectionRectForComplexText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
+void FontCascade::adjustSelectionRectForComplexText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
{
ComplexTextController controller(this, run);
controller.advance(from);
selectionRect.setWidth(afterWidth - beforeWidth);
}
-float Font::getGlyphsAndAdvancesForComplexText(const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
+float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
{
float initialAdvance;
return initialAdvance;
}
-float Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
+float FontCascade::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
{
// This glyph buffer holds our glyphs + advances + font data for each glyph.
GlyphBuffer glyphBuffer;
return startPoint.x() - startX;
}
-void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
+void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
{
GlyphBuffer glyphBuffer;
float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis);
drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
}
-float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
{
ComplexTextController controller(this, run, true, fallbackFonts);
if (glyphOverflow) {
return controller.totalWidth();
}
-int Font::offsetForPositionForComplexText(const TextRun& run, float x, bool includePartialGlyphs) const
+int FontCascade::offsetForPositionForComplexText(const TextRun& run, float x, bool includePartialGlyphs) const
{
ComplexTextController controller(this, run);
return controller.offsetForPosition(x, includePartialGlyphs);
}
-const SimpleFontData* Font::fontDataForCombiningCharacterSequence(const UChar* characters, size_t length, FontDataVariant variant) const
+const SimpleFontData* FontCascade::fontDataForCombiningCharacterSequence(const UChar* characters, size_t length, FontDataVariant variant) const
{
UChar32 baseCharacter;
size_t baseCharacterLength = 0;
*/
#import "config.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "CoreGraphicsSPI.h"
#import "CoreTextSPI.h"
namespace WebCore {
-bool Font::canReturnFallbackFontsForComplexText()
+bool FontCascade::canReturnFallbackFontsForComplexText()
{
return true;
}
-bool Font::canExpandAroundIdeographsInComplexText()
+bool FontCascade::canExpandAroundIdeographsInComplexText()
{
return true;
}
}
#endif
-void Font::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& anchorPoint) const
+void FontCascade::drawGlyphs(GraphicsContext* context, const SimpleFontData* font, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& anchorPoint) const
{
const FontPlatformData& platformData = font->platformData();
if (!platformData.size())
} while (m_fontData->isSVGFont() && m_index < m_glyphBuffer.size());
}
-DashArray Font::dashesForIntersectionsWithRect(const TextRun& run, const FloatPoint& textOrigin, const FloatRect& lineExtents) const
+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) != Font::Complex)
+ if (codePath(run) != FontCascade::Complex)
deltaX = getGlyphsAndAdvancesForSimpleText(run, 0, run.length(), glyphBuffer);
else
deltaX = getGlyphsAndAdvancesForComplexText(run, 0, run.length(), glyphBuffer);
}
#endif
-bool Font::primaryFontDataIsSystemFont() const
+bool FontCascade::primaryFontDataIsSystemFont() const
{
#if PLATFORM(IOS) || __MAC_OS_X_VERSION_MIN_REQUIRED > 1090
const auto& fontData = primaryFontData();
#include "CoreGraphicsSPI.h"
#include "CoreTextSPI.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "SimpleFontData.h"
#include "WebCoreSystemInterface.h"
#if !PLATFORM(IOS)
if (fontData->platformData().widthVariant() != RegularWidth || fontData->hasVerticalGlyphs()) {
// Ideographs don't have a vertical variant or width variants.
for (unsigned i = 0; i < bufferLength; ++i) {
- if (!Font::isCJKIdeograph(buffer[i]))
+ if (!FontCascade::isCJKIdeograph(buffer[i]))
return true;
}
}
#import "CoreGraphicsSPI.h"
#import "CoreTextSPI.h"
#import "FloatRect.h"
-#import "Font.h"
#import "FontCache.h"
+#import "FontCascade.h"
#import "FontDescription.h"
#import "SharedBuffer.h"
#import "WebCoreSystemInterface.h"
*/
#include "config.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "AffineTransform.h"
#include "FloatConversion.h"
return path;
}
-void Font::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
+void FontCascade::drawGlyphs(GraphicsContext* graphicsContext, const SimpleFontData* font, const GlyphBuffer& glyphBuffer,
int from, int numGlyphs, const FloatPoint& point) const
{
CGContextRef cgContext = graphicsContext->platformContext();
#include "config.h"
#include <winsock2.h>
#include "FontCache.h"
-#include "Font.h"
#include "HWndDC.h"
#include "SimpleFontData.h"
#include <mlang.h>
*/
#include "config.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "FontGlyphs.h"
#include "GlyphBuffer.h"
namespace WebCore {
-bool Font::canReturnFallbackFontsForComplexText()
+bool FontCascade::canReturnFallbackFontsForComplexText()
{
return true;
}
-bool Font::canExpandAroundIdeographsInComplexText()
+bool FontCascade::canExpandAroundIdeographsInComplexText()
{
return false;
}
-void Font::adjustSelectionRectForComplexText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
+void FontCascade::adjustSelectionRectForComplexText(const TextRun& run, LayoutRect& selectionRect, int from, int to) const
{
UniscribeController it(this, run);
it.advance(from);
selectionRect.setWidth(afterWidth - beforeWidth);
}
-float Font::getGlyphsAndAdvancesForComplexText(const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
+float FontCascade::getGlyphsAndAdvancesForComplexText(const TextRun& run, int from, int to, GlyphBuffer& glyphBuffer, ForTextEmphasisOrNot forTextEmphasis) const
{
if (forTextEmphasis) {
// FIXME: Add forTextEmphasis paremeter to UniscribeController and use it.
return beforeWidth;
}
-float Font::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
+float FontCascade::drawComplexText(GraphicsContext* context, const TextRun& run, const FloatPoint& point, int from, int to) const
{
// This glyph buffer holds our glyphs + advances + font data for each glyph.
GlyphBuffer glyphBuffer;
return startPoint.x() - startX;
}
-void Font::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
+void FontCascade::drawEmphasisMarksForComplexText(GraphicsContext* context, const TextRun& run, const AtomicString& mark, const FloatPoint& point, int from, int to) const
{
GlyphBuffer glyphBuffer;
float initialAdvance = getGlyphsAndAdvancesForComplexText(run, from, to, glyphBuffer, ForTextEmphasis);
drawEmphasisMarks(context, run, glyphBuffer, mark, FloatPoint(point.x() + initialAdvance, point.y()));
}
-float Font::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float FontCascade::floatWidthForComplexText(const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
{
UniscribeController controller(this, run, fallbackFonts);
controller.advance(run.length());
return controller.runWidthSoFar();
}
-int Font::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const
+int FontCascade::offsetForPositionForComplexText(const TextRun& run, float xFloat, bool includePartialGlyphs) const
{
// FIXME: This truncation is not a problem for HTML, but only affects SVG, which passes floating-point numbers
- // to Font::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem.
+ // to FontCascade::offsetForPosition(). Bug http://webkit.org/b/40673 tracks fixing this problem.
int x = static_cast<int>(xFloat);
UniscribeController controller(this, run);
#include "SimpleFontData.h"
#include "FloatRect.h"
-#include "Font.h"
#include "FontCache.h"
#include "FontDescription.h"
#include "GlyphPage.h"
#include <windows.h>
-#include "Font.h"
#include "FontCache.h"
#include "FontDescription.h"
#include "HWndDC.h"
#include "config.h"
#include "SimpleFontData.h"
-#include "Font.h"
#include "FontCache.h"
#include "FloatRect.h"
#include "FontDescription.h"
#include "config.h"
#include "UniscribeController.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "HWndDC.h"
#include "SimpleFontData.h"
#include "TextRun.h"
// that does stuff in that method instead of doing everything in the constructor. Have advance()
// take the GlyphBuffer as an arg so that we don't have to populate the glyph buffer when
// measuring.
-UniscribeController::UniscribeController(const Font* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts)
+UniscribeController::UniscribeController(const FontCascade* font, const TextRun& run, HashSet<const SimpleFontData*>* fallbackFonts)
: m_font(*font)
, m_run(run)
, m_fallbackFonts(fallbackFonts)
else {
float numSpaces = 0;
for (int s = 0; s < m_run.length(); s++) {
- if (Font::treatAsSpace(m_run[s]))
+ if (FontCascade::treatAsSpace(m_run[s]))
numSpaces++;
}
for (int k = 0; k < len; k++) {
UChar ch = *(str + k);
- bool treatAsSpace = Font::treatAsSpace(ch);
- bool treatAsZeroWidthSpace = Font::treatAsZeroWidthSpace(ch);
+ bool treatAsSpace = FontCascade::treatAsSpace(ch);
+ bool treatAsZeroWidthSpace = FontCascade::treatAsZeroWidthSpace(ch);
if (treatAsSpace || treatAsZeroWidthSpace) {
// Substitute in the space glyph at the appropriate place in the glyphs
// array.
else
candidateSpace = *(m_run.data16(characterIndex - 1));
- if (!Font::treatAsSpace(candidateSpace))
+ if (!FontCascade::treatAsSpace(candidateSpace))
advance += m_font.wordSpacing();
}
}
#ifndef UniscribeController_h
#define UniscribeController_h
-#include <usp10.h>
-#include "Font.h"
+#include "FontCascade.h"
#include "GlyphBuffer.h"
+#include <usp10.h>
#include <wtf/Vector.h>
namespace WebCore {
class UniscribeController {
public:
- UniscribeController(const Font*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0);
+ UniscribeController(const FontCascade*, const TextRun&, HashSet<const SimpleFontData*>* fallbackFonts = 0);
// Advance and measure/place up to the specified character.
void advance(unsigned to, GlyphBuffer* = 0);
Vector<WORD>& glyphs, Vector<WORD>& clusters,
Vector<SCRIPT_VISATTR>& visualAttributes);
- const Font& m_font;
+ const FontCascade& m_font;
const TextRun& m_run;
HashSet<const SimpleFontData*>* m_fallbackFonts;
FloatPoint m_glyphOrigin;
#import "BlockExceptions.h"
#import "Cursor.h"
#import "Document.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "Frame.h"
#import "GraphicsContext.h"
#import "Page.h"
#if PLATFORM(IOS)
#import "CoreGraphicsSPI.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "WebCoreSystemInterface.h"
#import "WebCoreThread.h"
#import <ImageIO/ImageIO.h>
#if ENABLE(DRAG_SUPPORT)
#import "BitmapImage.h"
#import "CoreGraphicsSPI.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "FontDescription.h"
#import "FontSelector.h"
#import "GraphicsContext.h"
// FIXME - we should move all the functionality of NSString extras to WebCore
-static Font& fontFromNSFont(NSFont *font)
+static FontCascade& fontFromNSFont(NSFont *font)
{
static NSFont *currentFont;
- DEPRECATED_DEFINE_STATIC_LOCAL(Font, currentRenderer, ());
+ DEPRECATED_DEFINE_STATIC_LOCAL(FontCascade, currentRenderer, ());
if ([font isEqual:currentFont])
return currentRenderer;
currentFont = font;
CFRetain(currentFont);
FontPlatformData f(font, [font pointSize]);
- currentRenderer = Font(f, ![[NSGraphicsContext currentContext] isDrawingToScreen]);
+ currentRenderer = FontCascade(f, ![[NSGraphicsContext currentContext] isDrawingToScreen]);
return currentRenderer;
}
[string getCharacters:buffer.data()];
if (canUseFastRenderer(buffer.data(), length)) {
- Font webCoreFont(FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
+ FontCascade webCoreFont(FontPlatformData(font, [font pointSize]), ![[NSGraphicsContext currentContext] isDrawingToScreen]);
TextRun run(buffer.data(), length);
run.disableRoundingHacks();
return webCoreFont.width(run);
if (!flipped)
CGContextScaleCTM(cgContext, 1, -1);
- Font webCoreFont(FontPlatformData(font, [font pointSize]), ![nsContext isDrawingToScreen], Antialiased);
+ FontCascade webCoreFont(FontPlatformData(font, [font pointSize]), ![nsContext isDrawingToScreen], Antialiased);
TextRun run(buffer.data(), length);
run.disableRoundingHacks();
virtual int baselinePositionAdjustment(ControlPart) const;
- virtual FontDescription controlFont(ControlPart, const Font&, float zoomFactor) const;
+ virtual FontDescription controlFont(ControlPart, const FontCascade&, float zoomFactor) const;
- virtual LengthSize controlSize(ControlPart, const Font&, const LengthSize&, float zoomFactor) const;
- virtual LengthSize minimumControlSize(ControlPart, const Font&, float zoomFactor) const;
+ virtual LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize&, float zoomFactor) const;
+ virtual LengthSize minimumControlSize(ControlPart, const FontCascade&, float zoomFactor) const;
- virtual LengthBox controlPadding(ControlPart, const Font&, const LengthBox& zoomedBox, float zoomFactor) const;
- virtual LengthBox controlBorder(ControlPart, const Font&, const LengthBox& zoomedBox, float zoomFactor) const;
+ virtual LengthBox controlPadding(ControlPart, const FontCascade&, const LengthBox& zoomedBox, float zoomFactor) const;
+ virtual LengthBox controlBorder(ControlPart, const FontCascade&, const LengthBox& zoomedBox, float zoomFactor) const;
virtual bool controlRequiresPreWhiteSpace(ControlPart part) const { return part == PushButtonPart; }
// Helper functions used by a bunch of different control parts.
-static NSControlSize controlSizeForFont(const Font& font)
+static NSControlSize controlSizeForFont(const FontCascade& font)
{
int fontSize = font.pixelSize();
if (fontSize >= 16)
return result;
}
-static LengthSize sizeFromFont(const Font& font, const LengthSize& zoomedSize, float zoomFactor, const std::array<IntSize, 3>& sizes)
+static LengthSize sizeFromFont(const FontCascade& font, const LengthSize& zoomedSize, float zoomFactor, const std::array<IntSize, 3>& sizes)
{
return sizeFromNSControlSize(controlSizeForFont(font), zoomedSize, zoomFactor, sizes);
}
return margins[controlSize];
}
-static LengthSize checkboxSize(const Font& font, const LengthSize& zoomedSize, float zoomFactor)
+static LengthSize checkboxSize(const FontCascade& font, const LengthSize& zoomedSize, float zoomFactor)
{
// If the width and height are both specified, then we have nothing to do.
if (!zoomedSize.width().isIntrinsicOrAuto() && !zoomedSize.height().isIntrinsicOrAuto())
return margins[controlSize];
}
-static LengthSize radioSize(const Font& font, const LengthSize& zoomedSize, float zoomFactor)
+static LengthSize radioSize(const FontCascade& font, const LengthSize& zoomedSize, float zoomFactor)
{
// If the width and height are both specified, then we have nothing to do.
if (!zoomedSize.width().isIntrinsicOrAuto() && !zoomedSize.height().isIntrinsicOrAuto())
// We don't use controlSizeForFont() for steppers because the stepper height
// should be equal to or less than the corresponding text field height,
-static NSControlSize stepperControlSizeForFont(const Font& font)
+static NSControlSize stepperControlSizeForFont(const FontCascade& font)
{
int fontSize = font.pixelSize();
if (fontSize >= 18)
return Theme::baselinePositionAdjustment(part);
}
-FontDescription ThemeMac::controlFont(ControlPart part, const Font& font, float zoomFactor) const
+FontDescription ThemeMac::controlFont(ControlPart part, const FontCascade& font, float zoomFactor) const
{
switch (part) {
case PushButtonPart: {
}
}
-LengthSize ThemeMac::controlSize(ControlPart part, const Font& font, const LengthSize& zoomedSize, float zoomFactor) const
+LengthSize ThemeMac::controlSize(ControlPart part, const FontCascade& font, const LengthSize& zoomedSize, float zoomFactor) const
{
switch (part) {
case CheckboxPart:
}
}
-LengthSize ThemeMac::minimumControlSize(ControlPart part, const Font& font, float zoomFactor) const
+LengthSize ThemeMac::minimumControlSize(ControlPart part, const FontCascade& font, float zoomFactor) const
{
switch (part) {
case SquareButtonPart:
}
}
-LengthBox ThemeMac::controlBorder(ControlPart part, const Font& font, const LengthBox& zoomedBox, float zoomFactor) const
+LengthBox ThemeMac::controlBorder(ControlPart part, const FontCascade& font, const LengthBox& zoomedBox, float zoomFactor) const
{
switch (part) {
case SquareButtonPart:
}
}
-LengthBox ThemeMac::controlPadding(ControlPart part, const Font& font, const LengthBox& zoomedBox, float zoomFactor) const
+LengthBox ThemeMac::controlPadding(ControlPart part, const FontCascade& font, const LengthBox& zoomedBox, float zoomFactor) const
{
switch (part) {
case PushButtonPart: {
#import "Chrome.h"
#import "Cursor.h"
#import "Document.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "Frame.h"
#import "FrameView.h"
#import "GraphicsContext.h"
namespace WebCore {
#if PLATFORM(IOS)
-class Font;
+class FontCascade;
#endif
class Locale {
#define LocalizedDateCache_h
#include "DateComponents.h"
-#include "Font.h"
+#include "FontCascade.h"
#include <wtf/HashMap.h>
#include <wtf/NeverDestroyed.h>
#include <wtf/RetainPtr.h>
class LocalizedDateCache {
public:
NSDateFormatter *formatterForDateType(DateComponents::Type);
- float maximumWidthForDateType(DateComponents::Type, const Font&, const MeasureTextClient&);
+ float maximumWidthForDateType(DateComponents::Type, const FontCascade&, const MeasureTextClient&);
void localeChanged();
private:
typedef HashMap<int, float> DateTypeMaxWidthMap;
DateTypeFormatterMap m_formatterMap;
DateTypeMaxWidthMap m_maxWidthMap;
- Font m_font;
+ FontCascade m_font;
friend LocalizedDateCache& localizedDateCache();
friend NeverDestroyed<LocalizedDateCache>;
#import "config.h"
#import "LocalizedDateCache.h"
-#import "Font.h"
+#import "FontCascade.h"
#import "TextRun.h"
#import <math.h>
#import <wtf/Assertions.h>
}
LocalizedDateCache::LocalizedDateCache()
- : m_font(Font())
{
// Listen to CF Notifications for locale change, and clear the cache when it does.
CFNotificationCenterAddObserver(CFNotificationCenterGetLocalCenter(), (void*)this, _localeChanged,
return dateFormatter;
}
-float LocalizedDateCache::maximumWidthForDateType(DateComponents::Type type, const Font& font, const MeasureTextClient& measurer)
+float LocalizedDateCache::maximumWidthForDateType(DateComponents::Type type, const FontCascade& font, const MeasureTextClient& measurer)
{
int key = static_cast<int>(type);
if (m_font == font) {
if (m_maxWidthMap.contains(key))
return m_maxWidthMap.get(key);
} else {
- m_font = Font(font);
+ m_font = FontCascade(font);
m_maxWidthMap.clear();
}
#include "EllipsisBox.h"
#include "Document.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "GraphicsContext.h"
#include "HitTestResult.h"
#include "InlineTextBox.h"
setShadow = true;
}
- const Font& font = lineStyle.font();
+ const FontCascade& font = lineStyle.fontCascade();
if (selectionState() != RenderObject::SelectionNone) {
paintSelection(context, paintOffset, lineStyle, font);
IntRect EllipsisBox::selectionRect()
{
const RenderStyle& lineStyle = this->lineStyle();
- const Font& font = lineStyle.font();
+ const FontCascade& font = lineStyle.fontCascade();
const RootInlineBox& rootBox = root();
// FIXME: Why is this always LTR? Fix by passing correct text run flags below.
LayoutRect selectionRect = LayoutRect(x(), y() + rootBox.selectionTopAdjustedForPrecedingBlock(), 0, rootBox.selectionHeightAdjustedForPrecedingBlock());
return enclosingIntRect(selectionRect);
}
-void EllipsisBox::paintSelection(GraphicsContext* context, const LayoutPoint& paintOffset, const RenderStyle& style, const Font& font)
+void EllipsisBox::paintSelection(GraphicsContext* context, const LayoutPoint& paintOffset, const RenderStyle& style, const FontCascade& font)
{
Color textColor = style.visitedDependentColor(CSSPropertyColor);
Color c = blockFlow().selectionBackgroundColor();
void paintMarkupBox(PaintInfo&, const LayoutPoint& paintOffset, LayoutUnit lineTop, LayoutUnit lineBottom, const RenderStyle&);
int height() const { return m_height; }
virtual RenderObject::SelectionState selectionState() override { return m_selectionState; }
- void paintSelection(GraphicsContext*, const LayoutPoint&, const RenderStyle&, const Font&);
+ void paintSelection(GraphicsContext*, const LayoutPoint&, const RenderStyle&, const FontCascade&);
InlineBox* markupBox() const;
bool m_shouldPaintMarkupBox;
#include "CSSPropertyNames.h"
#include "Document.h"
#include "EllipsisBox.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "GraphicsContext.h"
#include "InlineTextBox.h"
#include "HitTestResult.h"
shouldClearDescendantsHaveSameLineHeightAndBaseline = true;
else if (child->behavesLikeText()) {
if (child->renderer().isLineBreak() || child->renderer().parent() != &renderer()) {
- if (!parentStyle.font().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle.font().fontMetrics())
+ if (!parentStyle.fontCascade().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle.fontCascade().fontMetrics())
|| parentStyle.lineHeight() != childStyle.lineHeight()
|| (parentStyle.verticalAlign() != BASELINE && !isRootInlineBox()) || childStyle.verticalAlign() != BASELINE)
shouldClearDescendantsHaveSameLineHeightAndBaseline = true;
auto& childFlowBox = downcast<InlineFlowBox>(*child);
// Check the child's bit, and then also check for differences in font, line-height, vertical-align
if (!childFlowBox.descendantsHaveSameLineHeightAndBaseline()
- || !parentStyle.font().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle.font().fontMetrics())
+ || !parentStyle.fontCascade().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle.fontCascade().fontMetrics())
|| parentStyle.lineHeight() != childStyle.lineHeight()
|| (parentStyle.verticalAlign() != BASELINE && !isRootInlineBox()) || childStyle.verticalAlign() != BASELINE
|| childStyle.hasBorder() || childStyle.hasPadding() || childStyle.hasTextCombine())
RenderText& renderText = textBox.renderer();
if (renderText.textLength()) {
if (needsWordSpacing && isSpaceOrNewline(renderText.characterAt(textBox.start())))
- logicalLeft += textBox.lineStyle().font().wordSpacing();
+ logicalLeft += textBox.lineStyle().fontCascade().wordSpacing();
needsWordSpacing = !isSpaceOrNewline(renderText.characterAt(textBox.end()));
}
textBox.setLogicalLeft(logicalLeft);
const RenderStyle& lineStyle = this->lineStyle();
if (lineStyle.fontDescription().nonCJKGlyphOrientation() == NonCJKGlyphOrientationUpright
- || lineStyle.font().primaryFontData().hasVerticalGlyphs())
+ || lineStyle.fontCascade().primaryFontData().hasVerticalGlyphs())
return true;
for (InlineBox* child = firstChild(); child; child = child->nextOnLine()) {
if (downcast<InlineFlowBox>(*child).requiresIdeographicBaseline(textBoxDataMap))
return true;
} else {
- if (child->lineStyle().font().primaryFontData().hasVerticalGlyphs())
+ if (child->lineStyle().fontCascade().primaryFontData().hasVerticalGlyphs())
return true;
const Vector<const SimpleFontData*>* usedFonts = nullptr;
bool emphasisMarkIsAbove;
if (lineStyle.textEmphasisMark() != TextEmphasisMarkNone && textBox.emphasisMarkExistsAndIsAbove(lineStyle, emphasisMarkIsAbove)) {
- int emphasisMarkHeight = lineStyle.font().emphasisMarkHeight(lineStyle.textEmphasisMarkString());
+ int emphasisMarkHeight = lineStyle.fontCascade().emphasisMarkHeight(lineStyle.textEmphasisMarkString());
if (emphasisMarkIsAbove == !lineStyle.isFlippedLinesWritingMode())
topGlyphOverflow = std::min(topGlyphOverflow, -emphasisMarkHeight);
else
// If letter-spacing is negative, we should factor that into right layout overflow. (Even in RTL, letter-spacing is
// applied to the right, so this is not an issue with left overflow.
- rightGlyphOverflow -= std::min(0, (int)lineStyle.font().letterSpacing());
+ rightGlyphOverflow -= std::min(0, (int)lineStyle.fontCascade().letterSpacing());
LayoutUnit textShadowLogicalTop;
LayoutUnit textShadowLogicalBottom;
bool emphasisMarkIsAbove;
if (childLineStyle.textEmphasisMark() != TextEmphasisMarkNone && downcast<InlineTextBox>(*child).emphasisMarkExistsAndIsAbove(childLineStyle, emphasisMarkIsAbove) && emphasisMarkIsAbove) {
if (!childLineStyle.isFlippedLinesWritingMode()) {
- int topOfEmphasisMark = child->logicalTop() - childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
+ int topOfEmphasisMark = child->logicalTop() - childLineStyle.fontCascade().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
result = std::max(result, allowedPosition - topOfEmphasisMark);
} else {
- int bottomOfEmphasisMark = child->logicalBottom() + childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
+ int bottomOfEmphasisMark = child->logicalBottom() + childLineStyle.fontCascade().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
result = std::max(result, bottomOfEmphasisMark - allowedPosition);
}
}
downcast<InlineTextBox>(*child).emphasisMarkExistsAndIsAbove(childLineStyle, emphasisMarkIsAbove);
if (childLineStyle.textEmphasisMark() != TextEmphasisMarkNone && !emphasisMarkIsAbove) {
if (!childLineStyle.isFlippedLinesWritingMode()) {
- LayoutUnit bottomOfEmphasisMark = child->logicalBottom() + childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
+ LayoutUnit bottomOfEmphasisMark = child->logicalBottom() + childLineStyle.fontCascade().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
result = std::max(result, bottomOfEmphasisMark - allowedPosition);
} else {
- LayoutUnit topOfEmphasisMark = child->logicalTop() - childLineStyle.font().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
+ LayoutUnit topOfEmphasisMark = child->logicalTop() - childLineStyle.fontCascade().emphasisMarkHeight(childLineStyle.textEmphasisMarkString());
result = std::max(result, allowedPosition - topOfEmphasisMark);
}
}
return state;
}
-static const Font& fontToUse(const RenderStyle& style, const RenderText& renderer)
+static const FontCascade& fontToUse(const RenderStyle& style, const RenderText& renderer)
{
if (style.hasTextCombine() && is<RenderCombineText>(renderer)) {
const auto& textCombineRenderer = downcast<RenderCombineText>(renderer);
if (textCombineRenderer.isCombined())
return textCombineRenderer.textCombineFont();
}
- return style.font();
+ return style.fontCascade();
}
LayoutRect InlineTextBox::localSelectionRect(int startPos, int endPos) const
LayoutUnit selectionTop = this->selectionTop();
LayoutUnit selectionHeight = this->selectionHeight();
const RenderStyle& lineStyle = this->lineStyle();
- const Font& font = fontToUse(lineStyle, renderer());
+ const FontCascade& font = fontToUse(lineStyle, renderer());
String hyphenatedStringBuffer;
bool respectHyphen = ePos == m_len && hasHyphen();
selectionPaintStyle = textPaintStyle;
// Set our font.
- const Font& font = fontToUse(lineStyle, renderer());
+ const FontCascade& font = fontToUse(lineStyle, renderer());
// 1. Paint backgrounds behind text if needed. Examples of such backgrounds include selection
// and composition underlines.
if (paintInfo.phase != PaintPhaseSelection && paintInfo.phase != PaintPhaseTextClip && !isPrinting) {
ePos = std::min(endPos - m_start, (int)m_len);
}
-void InlineTextBox::paintSelection(GraphicsContext& context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, Color textColor)
+void InlineTextBox::paintSelection(GraphicsContext& context, const FloatPoint& boxOrigin, const RenderStyle& style, const FontCascade& font, Color textColor)
{
#if ENABLE(TEXT_SELECTION)
if (context.paintingDisabled())
#endif
}
-void InlineTextBox::paintCompositionBackground(GraphicsContext& context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, int startPos, int endPos)
+void InlineTextBox::paintCompositionBackground(GraphicsContext& context, const FloatPoint& boxOrigin, const RenderStyle& style, const FontCascade& font, int startPos, int endPos)
{
int offset = m_start;
int sPos = std::max(startPos - offset, 0);
}
}
-void InlineTextBox::paintDocumentMarker(GraphicsContext& context, const FloatPoint& boxOrigin, RenderedDocumentMarker& marker, const RenderStyle& style, const Font& font, bool grammar)
+void InlineTextBox::paintDocumentMarker(GraphicsContext& context, const FloatPoint& boxOrigin, RenderedDocumentMarker& marker, const RenderStyle& style, const FontCascade& font, bool grammar)
{
// Never print spelling/grammar markers (5327887)
if (renderer().document().printing())
context.drawLineForDocumentMarker(FloatPoint(boxOrigin.x() + start, boxOrigin.y() + underlineOffset), width, lineStyleForMarkerType(marker.type()));
}
-void InlineTextBox::paintTextMatchMarker(GraphicsContext& context, const FloatPoint& boxOrigin, RenderedDocumentMarker& marker, const RenderStyle& style, const Font& font)
+void InlineTextBox::paintTextMatchMarker(GraphicsContext& context, const FloatPoint& boxOrigin, RenderedDocumentMarker& marker, const RenderStyle& style, const FontCascade& font)
{
LayoutUnit selectionHeight = this->selectionHeight();
}
}
-void InlineTextBox::computeRectForReplacementMarker(RenderedDocumentMarker& marker, const RenderStyle& style, const Font& font)
+void InlineTextBox::computeRectForReplacementMarker(RenderedDocumentMarker& marker, const RenderStyle& style, const FontCascade& font)
{
// Replacement markers are not actually drawn, but their rects need to be computed for hit testing.
LayoutUnit top = selectionTop();
marker.setRenderedRect(markerRect);
}
-void InlineTextBox::paintDocumentMarkers(GraphicsContext& context, const FloatPoint& boxOrigin, const RenderStyle& style, const Font& font, bool background)
+void InlineTextBox::paintDocumentMarkers(GraphicsContext& context, const FloatPoint& boxOrigin, const RenderStyle& style, const FontCascade& font, bool background)
{
if (!renderer().textNode())
return;
return isLeftToRightDirection() ? 0 : len();
const RenderStyle& lineStyle = this->lineStyle();
- const Font& font = fontToUse(lineStyle, renderer());
+ const FontCascade& font = fontToUse(lineStyle, renderer());
return font.offsetForPosition(constructTextRun(lineStyle, font), lineOffset - logicalLeft(), includePartialGlyphs);
}
return logicalLeft();
const RenderStyle& lineStyle = this->lineStyle();
- const Font& font = fontToUse(lineStyle, renderer());
+ const FontCascade& font = fontToUse(lineStyle, renderer());
int from = !isLeftToRightDirection() ? offset - m_start : 0;
int to = !isLeftToRightDirection() ? m_len : offset - m_start;
// FIXME: Do we need to add rightBearing here?
return snapRectToDevicePixelsWithWritingDirection(selectionRect, renderer().document().deviceScaleFactor(), run.ltr()).maxX();
}
-TextRun InlineTextBox::constructTextRun(const RenderStyle& style, const Font& font, String* hyphenatedStringBuffer) const
+TextRun InlineTextBox::constructTextRun(const RenderStyle& style, const FontCascade& font, String* hyphenatedStringBuffer) const
{
ASSERT(renderer().text());
return constructTextRun(style, font, string, renderer().textLength() - startPos, hyphenatedStringBuffer);
}
-TextRun InlineTextBox::constructTextRun(const RenderStyle& style, const Font& font, String string, unsigned maximumLength, String* hyphenatedStringBuffer) const
+TextRun InlineTextBox::constructTextRun(const RenderStyle& style, const FontCascade& font, String string, unsigned maximumLength, String* hyphenatedStringBuffer) const
{
unsigned length = string.length();
LayoutUnit selectionBottom() const;
LayoutUnit selectionHeight() const;
- TextRun constructTextRun(const RenderStyle&, const Font&, String* hyphenatedStringBuffer = nullptr) const;
- TextRun constructTextRun(const RenderStyle&, const Font&, String, unsigned maximumLength, String* hyphenatedStringBuffer = nullptr) const;
+ TextRun constructTextRun(const RenderStyle&, const FontCascade&, String* hyphenatedStringBuffer = nullptr) const;
+ TextRun constructTextRun(const RenderStyle&, const FontCascade&, String, unsigned maximumLength, String* hyphenatedStringBuffer = nullptr) const;
public:
virtual FloatRect calculateBoundaries() const { return FloatRect(x(), y(), width(), height()); }
virtual float positionForOffset(int offset) const;
protected:
- void paintCompositionBackground(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, int startPos, int endPos);
- void paintDocumentMarkers(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, bool background);
+ void paintCompositionBackground(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const FontCascade&, int startPos, int endPos);
+ void paintDocumentMarkers(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const FontCascade&, bool background);
void paintCompositionUnderline(GraphicsContext&, const FloatPoint& boxOrigin, const CompositionUnderline&);
private:
void paintDecoration(GraphicsContext&, const FloatPoint& boxOrigin, TextDecoration, TextDecorationStyle, const ShadowData*, TextPainter&);
- void paintSelection(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const Font&, Color textColor);
- void paintDocumentMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const Font&, bool grammar);
- void paintTextMatchMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const Font&);
+ void paintSelection(GraphicsContext&, const FloatPoint& boxOrigin, const RenderStyle&, const FontCascade&, Color textColor);
+ void paintDocumentMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&, bool grammar);
+ void paintTextMatchMarker(GraphicsContext&, const FloatPoint& boxOrigin, RenderedDocumentMarker&, const RenderStyle&, const FontCascade&);
- void computeRectForReplacementMarker(RenderedDocumentMarker&, const RenderStyle&, const Font&);
+ void computeRectForReplacementMarker(RenderedDocumentMarker&, const RenderStyle&, const FontCascade&);
TextRun::ExpansionBehavior expansionBehavior() const
{
return left;
// FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge?
- float maxCharWidth = lineGrid->style().font().primaryFontData().maxCharWidth();
+ float maxCharWidth = lineGrid->style().fontCascade().primaryFontData().maxCharWidth();
if (!maxCharWidth)
return left;
return right;
// FIXME: Should letter-spacing apply? This is complicated since it doesn't apply at the edge?
- float maxCharWidth = lineGrid->style().font().primaryFontData().maxCharWidth();
+ float maxCharWidth = lineGrid->style().fontCascade().primaryFontData().maxCharWidth();
if (!maxCharWidth)
return right;
newFontDescription.setSpecifiedSize(startingFontSize);
newFontDescription.setComputedSize(startingFontSize);
pseudoStyle->setFontDescription(newFontDescription);
- pseudoStyle->font().update(pseudoStyle->font().fontSelector());
+ pseudoStyle->fontCascade().update(pseudoStyle->fontCascade().fontSelector());
int desiredCapHeight = (pseudoStyle->initialLetterHeight() - 1) * lineHeight + paragraph->style().fontMetrics().capHeight();
int actualCapHeight = pseudoStyle->fontMetrics().capHeight();
newFontDescription.setSpecifiedSize(newFontDescription.specifiedSize() - 1);
newFontDescription.setComputedSize(newFontDescription.computedSize() -1);
pseudoStyle->setFontDescription(newFontDescription);
- pseudoStyle->font().update(pseudoStyle->font().fontSelector());
+ pseudoStyle->fontCascade().update(pseudoStyle->fontCascade().fontSelector());
actualCapHeight = pseudoStyle->fontMetrics().capHeight();
}
}
}
template <typename CharacterType>
-static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
+static inline TextRun constructTextRunInternal(RenderObject* context, const FontCascade& font, const CharacterType* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
{
TextDirection textDirection = LTR;
bool directionalOverride = style.rtlOrdering() == VisualOrder;
}
template <typename CharacterType>
-static inline TextRun constructTextRunInternal(RenderObject* context, const Font& font, const CharacterType* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
+static inline TextRun constructTextRunInternal(RenderObject* context, const FontCascade& font, const CharacterType* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
{
TextDirection textDirection = LTR;
bool directionalOverride = style.rtlOrdering() == VisualOrder;
return run;
}
-TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const LChar* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
+TextRun RenderBlock::constructTextRun(RenderObject* context, const FontCascade& font, const LChar* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
{
return constructTextRunInternal(context, font, characters, length, style, expansion);
}
-TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const UChar* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
+TextRun RenderBlock::constructTextRun(RenderObject* context, const FontCascade& font, const UChar* characters, int length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
{
return constructTextRunInternal(context, font, characters, length, style, expansion);
}
-TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
+TextRun RenderBlock::constructTextRun(RenderObject* context, const FontCascade& font, const RenderText* text, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
{
if (text->is8Bit())
return constructTextRunInternal(context, font, text->characters8(), text->textLength(), style, expansion);
return constructTextRunInternal(context, font, text->characters16(), text->textLength(), style, expansion);
}
-TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const RenderText* text, unsigned offset, unsigned length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
+TextRun RenderBlock::constructTextRun(RenderObject* context, const FontCascade& font, const RenderText* text, unsigned offset, unsigned length, const RenderStyle& style, TextRun::ExpansionBehavior expansion)
{
ASSERT(offset + length <= text->textLength());
if (text->is8Bit())
return constructTextRunInternal(context, font, text->characters16() + offset, length, style, expansion);
}
-TextRun RenderBlock::constructTextRun(RenderObject* context, const Font& font, const String& string, const RenderStyle& style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
+TextRun RenderBlock::constructTextRun(RenderObject* context, const FontCascade& font, const String& string, const RenderStyle& style, TextRun::ExpansionBehavior expansion, TextRunFlags flags)
{
unsigned length = string.length();
return obj->isFloating() || (obj->isOutOfFlowPositioned() && !obj->style().isOriginalDisplayInlineType() && !obj->container()->isRenderInline());
}
- static TextRun constructTextRun(RenderObject* context, const Font&, const String&, const RenderStyle&,
+ static TextRun constructTextRun(RenderObject* context, const FontCascade&, const String&, const RenderStyle&,
TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion, TextRunFlags = DefaultTextRunFlags);
- static TextRun constructTextRun(RenderObject* context, const Font&, const RenderText*, const RenderStyle&,
+ static TextRun constructTextRun(RenderObject* context, const FontCascade&, const RenderText*, const RenderStyle&,
TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
- static TextRun constructTextRun(RenderObject* context, const Font&, const RenderText*, unsigned offset, unsigned length, const RenderStyle&,
+ static TextRun constructTextRun(RenderObject* context, const FontCascade&, const RenderText*, unsigned offset, unsigned length, const RenderStyle&,
TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
- static TextRun constructTextRun(RenderObject* context, const Font&, const RenderText*, unsigned offset, const RenderStyle&,
+ static TextRun constructTextRun(RenderObject* context, const FontCascade&, const RenderText*, unsigned offset, const RenderStyle&,
TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
- static TextRun constructTextRun(RenderObject* context, const Font&, const LChar* characters, int length, const RenderStyle&,
+ static TextRun constructTextRun(RenderObject* context, const FontCascade&, const LChar* characters, int length, const RenderStyle&,
TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
- static TextRun constructTextRun(RenderObject* context, const Font&, const UChar* characters, int length, const RenderStyle&,
+ static TextRun constructTextRun(RenderObject* context, const FontCascade&, const UChar* characters, int length, const RenderStyle&,
TextRun::ExpansionBehavior = TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion);
LayoutUnit paginationStrut() const;
// Collapse away the trailing space at the end of a block.
RenderText& renderText = downcast<RenderText>(*trailingSpaceChild);
const UChar space = ' ';
- const Font& font = renderText.style().font(); // FIXME: This ignores first-line.
+ const FontCascade& font = renderText.style().fontCascade(); // FIXME: This ignores first-line.
float spaceWidth = font.width(RenderBlock::constructTextRun(&renderText, font, &space, 1, renderText.style()));
inlineMax -= spaceWidth + font.wordSpacing();
if (inlineMin > inlineMax)
HashSet<const SimpleFontData*> fallbackFonts;
GlyphOverflow glyphOverflow;
- const Font& font = lineStyle(*renderer->parent(), lineInfo).font();
+ const FontCascade& font = lineStyle(*renderer->parent(), lineInfo).fontCascade();
// Always compute glyph overflow if the block's line-box-contain value is "glyphs".
if (lineBox->fitsToGlyphs()) {
// If we don't stick out of the root line's font box, then don't bother computing our glyph overflow. This optimization
&wordMeasurement.fallbackFonts, &overflow);
UChar c = renderer->characterAt(wordMeasurement.startOffset);
if (i > 0 && wordLength == 1 && (c == ' ' || c == '\t'))
- measuredWidth += renderer->style().font().wordSpacing();
+ measuredWidth += renderer->style().fontCascade().wordSpacing();
} else
measuredWidth += wordMeasurement.width;
if (!wordMeasurement.fallbackFonts.isEmpty()) {
if (textAlign == JUSTIFY && run != trailingSpaceRun) {
if (!isAfterExpansion)
downcast<InlineTextBox>(*run->box()).setCanHaveLeadingExpansion(true);
- unsigned opportunitiesInRun = Font::expansionOpportunityCount(renderText.stringView(run->m_start, run->m_stop), run->box()->direction(), isAfterExpansion);
+ unsigned opportunitiesInRun = FontCascade::expansionOpportunityCount(renderText.stringView(run->m_start, run->m_stop), run->box()->direction(), isAfterExpansion);
expansionOpportunities.append(opportunitiesInRun);
expansionOpportunityCount += opportunitiesInRun;
}
if (int length = renderText.textLength()) {
if (!run->m_start && needsWordSpacing && isSpaceOrNewline(renderText.characterAt(run->m_start)))
- totalLogicalWidth += lineStyle(*renderText.parent(), lineInfo).font().wordSpacing();
+ totalLogicalWidth += lineStyle(*renderText.parent(), lineInfo).fontCascade().wordSpacing();
needsWordSpacing = !isSpaceOrNewline(renderText.characterAt(run->m_stop - 1)) && run->m_stop == length;
}
downcast<InlineTextBox>(*leafChild).setCanHaveLeadingExpansion(true);
encounteredJustifiedRuby = true;
auto& renderText = downcast<RenderText>(leafChild->renderer());
- unsigned opportunitiesInRun = Font::expansionOpportunityCount(renderText.stringView(), leafChild->direction(), isAfterExpansion);
+ unsigned opportunitiesInRun = FontCascade::expansionOpportunityCount(renderText.stringView(), leafChild->direction(), isAfterExpansion);
expansionOpportunities.append(opportunitiesInRun);
expansionOpportunityCount += opportunitiesInRun;
}
{
// Determine the width of the ellipsis using the current font.
// FIXME: CSS3 says this is configurable, also need to use 0x002E (FULL STOP) if horizontal ellipsis is "not renderable"
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1));
- const Font& firstLineFont = firstLineStyle().font();
+ const FontCascade& firstLineFont = firstLineStyle().fontCascade();
float firstLineEllipsisWidth = firstLineFont.width(constructTextRun(this, firstLineFont, &horizontalEllipsis, 1, firstLineStyle()));
float ellipsisWidth = (font == firstLineFont) ? firstLineEllipsisWidth : font.width(constructTextRun(this, font, &horizontalEllipsis, 1, style()));
m_needsFontUpdate = true;
}
-float RenderCombineText::width(unsigned from, unsigned length, const Font& font, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float RenderCombineText::width(unsigned from, unsigned length, const FontCascade& font, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
{
if (m_isCombined)
return font.size();
float combinedTextWidth = width(0, textLength(), originalFont(), 0, nullptr, &glyphOverflow);
m_isCombined = combinedTextWidth <= emWidth;
- FontSelector* fontSelector = style().font().fontSelector();
+ FontSelector* fontSelector = style().fontCascade().fontSelector();
if (m_isCombined)
shouldUpdateFont = m_combineFontStyle->setFontDescription(description); // Need to change font orientation to horizontal.
static const FontWidthVariant widthVariants[] = { HalfWidth, ThirdWidth, QuarterWidth };
for (size_t i = 0 ; i < WTF_ARRAY_LENGTH(widthVariants) ; ++i) {
description.setWidthVariant(widthVariants[i]);
- Font compressedFont = Font(description, style().font().letterSpacing(), style().font().wordSpacing());
+
+ FontCascade compressedFont(description, style().fontCascade().letterSpacing(), style().fontCascade().wordSpacing());
compressedFont.update(fontSelector);
float runWidth = RenderText::width(0, textLength(), compressedFont, 0, nullptr, &glyphOverflow);
shouldUpdateFont = m_combineFontStyle->setFontDescription(originalFont().fontDescription());
if (shouldUpdateFont)
- m_combineFontStyle->font().update(fontSelector);
+ m_combineFontStyle->fontCascade().update(fontSelector);
if (m_isCombined) {
DEPRECATED_DEFINE_STATIC_LOCAL(String, objectReplacementCharacterString, (&objectReplacementCharacter, 1));
#ifndef RenderCombineText_h
#define RenderCombineText_h
-#include "Font.h"
+#include "FontCascade.h"
#include "RenderElement.h"
#include "RenderText.h"
#include "Text.h"
void adjustTextOrigin(FloatPoint& textOrigin, const FloatRect& boxRect) const;
void getStringToRender(int, String&, int& length) const;
bool isCombined() const { return m_isCombined; }
- float combinedTextWidth(const Font& font) const { return font.size(); }
- const Font& originalFont() const { return parent()->style().font(); }
- const Font& textCombineFont() const { return m_combineFontStyle->font(); }
+ float combinedTextWidth(const FontCascade& font) const { return font.size(); }
+ const FontCascade& originalFont() const { return parent()->style().fontCascade(); }
+ const FontCascade& textCombineFont() const { return m_combineFontStyle->fontCascade(); }
private:
void node() const = delete;
virtual bool isCombineText() const override { return true; }
- virtual float width(unsigned from, unsigned length, const Font&, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const override;
+ virtual float width(unsigned from, unsigned length, const FontCascade&, float xPosition, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const override;
virtual const char* renderName() const override { return "RenderCombineText"; }
virtual void styleDidChange(StyleDifference, const RenderStyle* oldStyle) override;
virtual void setRenderedText(const String&) override;
#include "config.h"
#include "RenderDeprecatedFlexibleBox.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "LayoutRepainter.h"
#include "RenderLayer.h"
#include "RenderView.h"
DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, ellipsisAndSpaceStr, (ellipsisAndSpace, 2));
DEPRECATED_DEFINE_STATIC_LOCAL(AtomicString, ellipsisStr, (&horizontalEllipsis, 1));
const RenderStyle& lineStyle = numVisibleLines == 1 ? firstLineStyle() : style();
- const Font& font = lineStyle.font();
+ const FontCascade& font = lineStyle.fontCascade();
// Get ellipsis width, and if the last child is an anchor, it will go after the ellipsis, so add in a space and the anchor width too
LayoutUnit totalWidth;
#include "ChromeClient.h"
#include "Cursor.h"
#include "EventHandler.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "FontSelector.h"
#include "Frame.h"
#include "FrameLoaderClient.h"
FloatRect indicatorRect;
FloatRect replacementTextRect;
FloatRect arrowRect;
- Font font;
+ FontCascade font;
TextRun run("");
float textWidth;
if (!getReplacementTextGeometry(paintOffset, contentRect, indicatorRect, replacementTextRect, arrowRect, font, run, textWidth))
repaint();
}
-bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, FloatRect& indicatorRect, FloatRect& replacementTextRect, FloatRect& arrowRect, Font& font, TextRun& run, float& textWidth) const
+bool RenderEmbeddedObject::getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, FloatRect& indicatorRect, FloatRect& replacementTextRect, FloatRect& arrowRect, FontCascade& font, TextRun& run, float& textWidth) const
{
bool includesArrow = shouldUnavailablePluginMessageBeButton(document(), m_pluginUnavailabilityReason);
fontDescription.setWeight(FontWeightBold);
fontDescription.setRenderingMode(frame().settings().fontRenderingMode());
fontDescription.setComputedSize(12);
- font = Font(fontDescription, 0, 0);
+ font = FontCascade(fontDescription, 0, 0);
font.update(0);
run = TextRun(m_unavailablePluginReplacementText);
FloatRect indicatorRect;
FloatRect replacementTextRect;
FloatRect arrowRect;
- Font font;
+ FontCascade font;
TextRun run("", 0);
float textWidth;
if (getReplacementTextGeometry(accumulatedOffset, contentRect, indicatorRect, replacementTextRect, arrowRect, font, run, textWidth))
FloatRect indicatorRect;
FloatRect replacementTextRect;
FloatRect arrowRect;
- Font font;
+ FontCascade font;
TextRun run("");
float textWidth;
return getReplacementTextGeometry(IntPoint(), contentRect, indicatorRect, replacementTextRect, arrowRect, font, run, textWidth)
void setUnavailablePluginIndicatorIsPressed(bool);
bool isInUnavailablePluginIndicator(const MouseEvent&) const;
bool isInUnavailablePluginIndicator(const FloatPoint&) const;
- bool getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, FloatRect& indicatorRect, FloatRect& replacementTextRect, FloatRect& arrowRect, Font&, TextRun&, float& textWidth) const;
+ bool getReplacementTextGeometry(const LayoutPoint& accumulatedOffset, FloatRect& contentRect, FloatRect& indicatorRect, FloatRect& replacementTextRect, FloatRect& arrowRect, FontCascade&, TextRun&, float& textWidth) const;
LayoutRect unavailablePluginIndicatorBounds(const LayoutPoint&) const;
virtual bool canHaveChildren() const override final;
#include "RenderFileUploadControl.h"
#include "FileList.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "GraphicsContext.h"
#include "HTMLInputElement.h"
#include "HTMLNames.h"
if (paintInfo.phase == PaintPhaseForeground) {
const String& displayedFilename = fileTextValue();
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
TextRun textRun = constructTextRun(this, font, displayedFilename, style(), TextRun::AllowTrailingExpansion, RespectDirection | RespectDirectionOverride);
textRun.disableRoundingHacks();
// (using "0" as the nominal character).
const UChar character = '0';
const String characterAsString = String(&character, 1);
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
// FIXME: Remove the need for this const_cast by making constructTextRun take a const RenderObject*.
RenderFileUploadControl* renderer = const_cast<RenderFileUploadControl*>(this);
float minDefaultLabelWidth = defaultWidthNumChars * font.width(constructTextRun(renderer, font, characterAsString, style(), TextRun::AllowTrailingExpansion));
ASSERT(inputElement().files());
#if PLATFORM(IOS)
if (inputElement().files()->length())
- return StringTruncator::rightTruncate(inputElement().displayString(), maxFilenameWidth(), style().font(), StringTruncator::EnableRoundingHacks);
+ return StringTruncator::rightTruncate(inputElement().displayString(), maxFilenameWidth(), style().fontCascade(), StringTruncator::EnableRoundingHacks);
#endif
- return theme().fileListNameForWidth(inputElement().files(), style().font(), maxFilenameWidth(), inputElement().multiple());
+ return theme().fileListNameForWidth(inputElement().files(), style().fontCascade(), maxFilenameWidth(), inputElement().multiple());
}
} // namespace WebCore
newStyle.get().setTop(Length(0, Fixed));
newStyle.get().setWidth(Length(100, Percent));
newStyle.get().setHeight(Length(100, Percent));
- newStyle.get().font().update(0);
+ newStyle.get().fontCascade().update(nullptr);
return newStyle;
}
fullscreenStyle.get().setZIndex(INT_MAX);
fullscreenStyle.get().setFontDescription(FontDescription());
- fullscreenStyle.get().font().update(0);
+ fullscreenStyle.get().fontCascade().update(nullptr);
fullscreenStyle.get().setDisplay(FLEX);
fullscreenStyle.get().setJustifyContent(JustifyCenter);
#include "BitmapImage.h"
#include "CachedImage.h"
-#include "Font.h"
#include "FontCache.h"
+#include "FontCascade.h"
#include "Frame.h"
#include "FrameSelection.h"
#include "GeometryUtilities.h"
// we have an alt and the user meant it (its not a text we invented)
if (!m_altText.isEmpty()) {
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
IntSize paddedTextSize(paddingWidth + std::min(ceilf(font.width(RenderBlock::constructTextRun(this, font, m_altText, style()))), maxAltTextWidth), paddingHeight + std::min(font.fontMetrics().height(), maxAltTextHeight));
imageSize = imageSize.expandedTo(paddedTextSize);
}
if (!m_altText.isEmpty()) {
String text = document().displayStringModifiedByEncoding(m_altText);
context->setFillColor(style().visitedDependentColor(CSSPropertyColor), style().colorSpace());
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
const FontMetrics& fontMetrics = font.fontMetrics();
LayoutUnit ascent = fontMetrics.ascent();
LayoutPoint altTextOffset = paintOffset;
|| (parentRenderInline && parentStyle->verticalAlign() != BASELINE)
|| style().verticalAlign() != BASELINE
|| style().textEmphasisMark() != TextEmphasisMarkNone
- || (checkFonts && (!parentStyle->font().fontMetrics().hasIdenticalAscentDescentAndLineGap(style().font().fontMetrics())
+ || (checkFonts && (!parentStyle->fontCascade().fontMetrics().hasIdenticalAscentDescentAndLineGap(style().fontCascade().fontMetrics())
|| parentStyle->lineHeight() != style().lineHeight()))
|| (flowThread && flowThread->isRenderNamedFlowThread()); // FIXME: Enable the optimization once we make overflow computation for culled inlines in regions.
// Have to check the first line style as well.
parentStyle = &parent()->firstLineStyle();
RenderStyle& childStyle = firstLineStyle();
- alwaysCreateLineBoxes = !parentStyle->font().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle.font().fontMetrics())
+ alwaysCreateLineBoxes = !parentStyle->fontCascade().fontMetrics().hasIdenticalAscentDescentAndLineGap(childStyle.fontCascade().fontMetrics())
|| childStyle.verticalAlign() != BASELINE
|| parentStyle->lineHeight() != childStyle.lineHeight();
}
if (renderBox.inlineBoxWrapper()) {
const RootInlineBox& rootBox = renderBox.inlineBoxWrapper()->root();
const RenderStyle& containerStyle = rootBox.isFirstLine() ? container->firstLineStyle() : container->style();
- int logicalTop = rootBox.logicalTop() + (rootBox.lineStyle().font().fontMetrics().ascent() - containerStyle.font().fontMetrics().ascent());
- int logicalHeight = containerStyle.font().fontMetrics().height();
+ int logicalTop = rootBox.logicalTop() + (rootBox.lineStyle().fontCascade().fontMetrics().ascent() - containerStyle.fontCascade().fontMetrics().ascent());
+ int logicalHeight = containerStyle.fontCascade().fontMetrics().height();
if (isHorizontal)
context.addRect(FloatRect(renderBox.inlineBoxWrapper()->x() - renderBox.marginLeft(), logicalTop, renderBox.width() + renderBox.horizontalMarginExtent(), logicalHeight));
else
for (InlineFlowBox* childLine = renderInline.firstLineBox(); childLine; childLine = childLine->nextLineBox()) {
const RootInlineBox& rootBox = childLine->root();
const RenderStyle& containerStyle = rootBox.isFirstLine() ? container->firstLineStyle() : container->style();
- int logicalTop = rootBox.logicalTop() + (rootBox.lineStyle().font().fontMetrics().ascent() - containerStyle.font().fontMetrics().ascent());
+ int logicalTop = rootBox.logicalTop() + (rootBox.lineStyle().fontCascade().fontMetrics().ascent() - containerStyle.fontCascade().fontMetrics().ascent());
int logicalHeight = containerStyle.fontMetrics().height();
if (isHorizontal) {
context.addRect(FloatRect(childLine->x() - childLine->marginLogicalLeft(),
for (InlineTextBox* childText = currText.firstTextBox(); childText; childText = childText->nextTextBox()) {
const RootInlineBox& rootBox = childText->root();
const RenderStyle& containerStyle = rootBox.isFirstLine() ? container->firstLineStyle() : container->style();
- int logicalTop = rootBox.logicalTop() + (rootBox.lineStyle().font().fontMetrics().ascent() - containerStyle.font().fontMetrics().ascent());
- int logicalHeight = containerStyle.font().fontMetrics().height();
+ int logicalTop = rootBox.logicalTop() + (rootBox.lineStyle().fontCascade().fontMetrics().ascent() - containerStyle.fontCascade().fontMetrics().ascent());
+ int logicalHeight = containerStyle.fontCascade().fontMetrics().height();
if (isHorizontal)
context.addRect(FloatRect(childText->x(), logicalTop, childText->logicalWidth(), logicalHeight));
else
// FIXME: This could use a helper to share these with text path.
const RootInlineBox& rootBox = inlineBox->root();
const RenderStyle& containerStyle = rootBox.isFirstLine() ? container->firstLineStyle() : container->style();
- int logicalTop = rootBox.logicalTop() + (rootBox.lineStyle().font().fontMetrics().ascent() - containerStyle.font().fontMetrics().ascent());
+ int logicalTop = rootBox.logicalTop() + (rootBox.lineStyle().fontCascade().fontMetrics().ascent() - containerStyle.fontCascade().fontMetrics().ascent());
int logicalHeight = containerStyle.fontMetrics().height();
if (isHorizontal)
context.addRect(FloatRect(inlineBox->x(), logicalTop, inlineBox->logicalWidth(), logicalHeight));
for (int i = 0; i < size; ++i) {
HTMLElement* element = listItems[i];
String text;
- Font itemFont = style().font();
+ FontCascade itemFont = style().fontCascade();
if (is<HTMLOptionElement>(*element))
text = downcast<HTMLOptionElement>(*element).textIndentedToRespectGroupLabel();
else if (is<HTMLOptGroupElement>(*element)) {
text = downcast<HTMLOptGroupElement>(*element).groupLabelText();
FontDescription d = itemFont.fontDescription();
d.setWeight(d.bolderWeight());
- itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing());
+ itemFont = FontCascade(d, itemFont.letterSpacing(), itemFont.wordSpacing());
itemFont.update(document().ensureStyleResolver().fontSelector());
}
}
}
-static LayoutSize itemOffsetForAlignment(TextRun textRun, RenderStyle* itemStyle, Font itemFont, LayoutRect itemBoudingBox)
+static LayoutSize itemOffsetForAlignment(TextRun textRun, RenderStyle* itemStyle, FontCascade itemFont, LayoutRect itemBoudingBox)
{
ETextAlign actualAlignment = itemStyle->textAlign();
// FIXME: Firefox doesn't respect JUSTIFY. Should we?
paintInfo.context->setFillColor(textColor, colorSpace);
TextRun textRun(itemText, 0, 0, TextRun::AllowTrailingExpansion, itemStyle->direction(), isOverride(itemStyle->unicodeBidi()), true, TextRun::NoRounding);
- Font itemFont = style().font();
+ FontCascade itemFont = style().fontCascade();
LayoutRect r = itemBoundingBoxRect(paintOffset, listIndex);
r.move(itemOffsetForAlignment(textRun, itemStyle, itemFont, r));
if (is<HTMLOptGroupElement>(*listItemElement)) {
FontDescription d = itemFont.fontDescription();
d.setWeight(d.bolderWeight());
- itemFont = Font(d, itemFont.letterSpacing(), itemFont.wordSpacing());
+ itemFont = FontCascade(d, itemFont.letterSpacing(), itemFont.wordSpacing());
itemFont.update(document().ensureStyleResolver().fontSelector());
}
#include "RenderListMarker.h"
#include "Document.h"
-#include "Font.h"
+#include "FontCascade.h"
#include "GraphicsContext.h"
#include "InlineElementBox.h"
#include "RenderLayer.h"
if (m_text.isEmpty())
return;
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
TextRun textRun = RenderBlock::constructTextRun(this, font, m_text, style());
GraphicsContextStateSaver stateSaver(*context, false);
return;
}
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
LayoutUnit logicalWidth = 0;
EListStyleType type = style().listStyleType();
switch (type) {
case Asterisks:
case Footnotes: {
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
TextRun run = RenderBlock::constructTextRun(this, font, m_text, style(), TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion, DefaultTextRunFlags);
relativeRect = IntRect(0, 0, font.width(run), font.fontMetrics().height());
break;
case Urdu:
if (m_text.isEmpty())
return IntRect();
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
TextRun run = RenderBlock::constructTextRun(this, font, m_text, style(), TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion, DefaultTextRunFlags);
int itemWidth = font.width(run);
UChar suffixSpace[2] = { listMarkerSuffix(type, m_listItem.value()), ' ' };
if (m_innerBlock) // RenderBlock handled updating the anonymous block's style.
adjustInnerStyle();
- bool fontChanged = !oldStyle || oldStyle->font() != style().font();
+ bool fontChanged = !oldStyle || oldStyle->fontCascade() != style().fontCascade();
if (fontChanged) {
updateOptionsWidth();
m_needsOptionsWidthUpdate = false;
if (RenderStyle* optionStyle = element->computedStyle())
optionWidth += minimumValueForLength(optionStyle->textIndent(), 0);
if (!text.isEmpty()) {
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
TextRun run = RenderBlock::constructTextRun(this, font, text, style(), TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion, DefaultTextRunFlags);
optionWidth += font.width(run);
}
maxOptionWidth = std::max(maxOptionWidth, optionWidth);
} else if (!text.isEmpty()) {
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
TextRun run = RenderBlock::constructTextRun(this, font, text, style(), TextRun::AllowTrailingExpansion | TextRun::ForbidLeadingExpansion, DefaultTextRunFlags);
maxOptionWidth = std::max(maxOptionWidth, font.width(run));
}
getItemBackgroundColor(listIndex, itemBackgroundColor, itemHasCustomBackgroundColor);
RenderStyle* style = element->renderStyle() ? element->renderStyle() : element->computedStyle();
- return style ? PopupMenuStyle(style->visitedDependentColor(CSSPropertyColor), itemBackgroundColor, style->font(), style->visibility() == VISIBLE,
+ return style ? PopupMenuStyle(style->visitedDependentColor(CSSPropertyColor), itemBackgroundColor, style->fontCascade(), style->visibility() == VISIBLE,
style->display() == NONE, true, style->textIndent(), style->direction(), isOverride(style->unicodeBidi()),
itemHasCustomBackgroundColor ? PopupMenuStyle::CustomBackgroundColor : PopupMenuStyle::DefaultBackgroundColor) : menuStyle();
}
const RenderStyle& styleToUse = m_innerBlock ? m_innerBlock->style() : style();
IntRect absBounds = absoluteBoundingBoxRectIgnoringTransforms();
return PopupMenuStyle(styleToUse.visitedDependentColor(CSSPropertyColor), styleToUse.visitedDependentColor(CSSPropertyBackgroundColor),
- styleToUse.font(), styleToUse.visibility() == VISIBLE, styleToUse.display() == NONE,
+ styleToUse.fontCascade(), styleToUse.visibility() == VISIBLE, styleToUse.display() == NONE,
style().hasAppearance() && style().appearance() == MenulistPart, styleToUse.textIndent(),
style().direction(), isOverride(style().unicodeBidi()), PopupMenuStyle::DefaultBackgroundColor,
PopupMenuStyle::SelectPopup, theme().popupMenuSize(styleToUse, absBounds));
if (isHorizontalWritingMode() && rt->style().rubyPosition() == RubyPositionInterCharacter) {
// Bopomofo. We need to move the RenderRubyText over to the right side and center it
// vertically relative to the base.
- const Font& font = style().font();
- float distanceBetweenBase = max(font.letterSpacing(), 2.0f * rt->style().font().fontMetrics().height());
+ const FontCascade& font = style().fontCascade();
+ float distanceBetweenBase = max(font.letterSpacing(), 2.0f * rt->style().fontCascade().fontMetrics().height());
setWidth(width() + distanceBetweenBase - font.letterSpacing());
if (RenderRubyBase* rb = rubyBase()) {
LayoutUnit firstLineTop = 0;
PopupMenuStyle RenderSearchField::menuStyle() const
{
- return PopupMenuStyle(style().visitedDependentColor(CSSPropertyColor), style().visitedDependentColor(CSSPropertyBackgroundColor), style().font(), style().visibility() == VISIBLE,
+ return PopupMenuStyle(style().visitedDependentColor(CSSPropertyColor), style().visitedDependentColor(CSSPropertyBackgroundColor), style().fontCascade(), style().visibility() == VISIBLE,
style().display() == NONE, true, style().textIndent(), style().direction(), isOverride(style().unicodeBidi()), PopupMenuStyle::CustomBackgroundColor);
}
bool RenderText::computeUseBackslashAsYenSymbol() const
{
const RenderStyle& style = this->style();
- const FontDescription& fontDescription = style.font().fontDescription();
- if (style.font().useBackslashAsYenSymbol())
+ const FontDescription& fontDescription = style.fontCascade().fontDescription();
+ if (style.fontCascade().useBackslashAsYenSymbol())
return true;
if (fontDescription.isSpecifiedFont())
return false;
if (!oldStyle) {
m_useBackslashAsYenSymbol = computeUseBackslashAsYenSymbol();
needsResetText = m_useBackslashAsYenSymbol;
- } else if (oldStyle->font().useBackslashAsYenSymbol() != newStyle.font().useBackslashAsYenSymbol()) {
+ } else if (oldStyle->fontCascade().useBackslashAsYenSymbol() != newStyle.fontCascade().useBackslashAsYenSymbol()) {
m_useBackslashAsYenSymbol = computeUseBackslashAsYenSymbol();
needsResetText = true;
}
return box.root().computeCaretRect(left, caretWidth, extraWidthToEndOfLine);
}
-ALWAYS_INLINE float RenderText::widthFromCache(const Font& f, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow, const RenderStyle& style) const
+ALWAYS_INLINE float RenderText::widthFromCache(const FontCascade& f, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow, const RenderStyle& style) const
{
if (style.hasTextCombine() && is<RenderCombineText>(*this)) {
const RenderCombineText& combineText = downcast<RenderCombineText>(*this);
ASSERT(m_text);
StringImpl& text = *m_text.impl();
if (text[0] == ' ' || (text[0] == '\n' && !style.preserveNewline()) || text[0] == '\t') {
- const Font& font = style.font(); // FIXME: This ignores first-line.
+ const FontCascade& font = style.fontCascade(); // FIXME: This ignores first-line.
if (stripFrontSpaces) {
const UChar space = ' ';
float spaceWidth = font.width(RenderBlock::constructTextRun(this, font, &space, 1, style));
// Compute our max widths by scanning the string for newlines.
if (hasBreak) {
- const Font& f = style.font(); // FIXME: This ignores first-line.
+ const FontCascade& f = style.fontCascade(); // FIXME: This ignores first-line.
bool firstLine = true;
beginMaxW = maxW;
endMaxW = maxW;
m_knownToHaveNoOverflowAndNoFallbackFonts = true;
}
-static inline float hyphenWidth(RenderText* renderer, const Font& font)
+static inline float hyphenWidth(RenderText* renderer, const FontCascade& font)
{
const RenderStyle& style = renderer->style();
return font.width(RenderBlock::constructTextRun(renderer, font, style.hyphenString().string(), style));
}
-static float maxWordFragmentWidth(RenderText* renderer, const RenderStyle& style, const Font& font, StringView word, int minimumPrefixLength, unsigned minimumSuffixLength, int& suffixStart, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)
+static float maxWordFragmentWidth(RenderText* renderer, const RenderStyle& style, const FontCascade& font, StringView word, int minimumPrefixLength, unsigned minimumSuffixLength, int& suffixStart, HashSet<const SimpleFontData*>& fallbackFonts, GlyphOverflow& glyphOverflow)
{
suffixStart = 0;
if (word.length() <= minimumSuffixLength)
m_hasEndWS = false;
const RenderStyle& style = this->style();
- const Font& font = style.font(); // FIXME: This ignores first-line.
+ const FontCascade& font = style.fontCascade(); // FIXME: This ignores first-line.
float wordSpacing = font.wordSpacing();
int len = textLength();
LazyLineBreakIterator breakIterator(m_text, style.locale(), mapLineBreakToIteratorMode(style.lineBreak()));
len = textLength() - from;
const RenderStyle& lineStyle = firstLine ? firstLineStyle() : style();
- return width(from, len, lineStyle.font(), xPos, fallbackFonts, glyphOverflow);
+ return width(from, len, lineStyle.fontCascade(), xPos, fallbackFonts, glyphOverflow);
}
-float RenderText::width(unsigned from, unsigned len, const Font& f, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
+float RenderText::width(unsigned from, unsigned len, const FontCascade& f, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow* glyphOverflow) const
{
ASSERT(from + len <= textLength());
if (!textLength())
const RenderStyle& style = this->style();
float w;
- if (&f == &style.font()) {
+ if (&f == &style.fontCascade()) {
if (!style.preserveNewline() && !from && len == textLength() && (!glyphOverflow || !glyphOverflow->computeBounds)) {
if (fallbackFonts) {
ASSERT(glyphOverflow);
{
if (isAllASCII() || m_text.is8Bit())
return true;
- return Font::characterRangeCodePath(characters16(), length()) == Font::Simple;
+ return FontCascade::characterRangeCodePath(characters16(), length()) == FontCascade::Simple;
}
void RenderText::momentarilyRevealLastTypedCharacter(unsigned offsetAfterLastTypedCharacter)
unsigned textLength() const { return m_text.impl()->length(); } // non virtual implementation of length()
void positionLineBox(InlineTextBox&);
- virtual float width(unsigned from, unsigned len, const Font&, float xPos, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
+ virtual float width(unsigned from, unsigned len, const FontCascade&, float xPos, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
virtual float width(unsigned from, unsigned len, float xPos, bool firstLine = false, HashSet<const SimpleFontData*>* fallbackFonts = 0, GlyphOverflow* = 0) const;
float minLogicalWidth() const;
virtual bool nodeAtPoint(const HitTestRequest&, HitTestResult&, const HitTestLocation&, const LayoutPoint&, HitTestAction) override final { ASSERT_NOT_REACHED(); return false; }
bool containsOnlyWhitespace(unsigned from, unsigned len) const;
- float widthFromCache(const Font&, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*, const RenderStyle&) const;
+ float widthFromCache(const FontCascade&, int start, int len, float xPos, HashSet<const SimpleFontData*>* fallbackFonts, GlyphOverflow*, const RenderStyle&) const;
bool isAllASCII() const { return m_isAllASCII; }
bool computeUseBackslashAsYenSymbol() const;
float RenderTextControl::getAverageCharWidth()
{
float width;
- if (style().font().fastAverageCharWidthIfAvailable(width))
+ if (style().fontCascade().fastAverageCharWidthIfAvailable(width))
return width;
const UChar ch = '0';
const String str = String(&ch, 1);
- const Font& font = style().font();
+ const FontCascade& font = style().fontCascade();
TextRun textRun = constructTextRun(this, font, str, style(), TextRun::AllowTrailingExpansion);
textRun.disableRoundingHacks();
return font.width(textRun);
{
// This matches the unitsPerEm value for MS Shell Dlg and Courier New from the "head" font table.
float unitsPerEm = 2048.0f;
- return roundf(style().font().size() * x / unitsPerEm);
+ return roundf(style().fontCascade().size() * x / unitsPerEm);
}
void RenderTextControl::computeIntrinsicLogicalWidths(LayoutUnit& minLogicalWidth, LayoutUnit& maxLogicalWidth) const
// Since Lucida Grande is the default font, we want this to match the width
// of Courier New, the default font for textareas in IE, Firefox and Safari Win.
// 1229 is the avgCharWidth value in the OS/2 table for Courier New.
- if (style().font().firstFamily() == "Lucida Grande")
+ if (style().fontCascade().firstFamily() == "Lucida Grande")
return scaleEmToUnits(1229);
#endif
// of MS Shell Dlg, the default font for textareas in Firefox, Safari Win and
// IE for some encodings (in IE, the default font is encoding specific).
// 901 is the avgCharWidth value in the OS/2 table for MS Shell Dlg.
- if (style().font().firstFamily() == "Lucida Grande")
+ if (style().fontCascade().firstFamily() == "Lucida Grande")
return scaleEmToUnits(901);
#endif
float maxCharWidth = 0.f;
#if !PLATFORM(IOS)
- const AtomicString& family = style().font().firstFamily();
+ const AtomicString& family = style().fontCascade().firstFamily();
// Since Lucida Grande is the default font, we want this to match the width
// of MS Shell Dlg, the default font for textareas in Firefox, Safari Win and
// IE for some encodings (in IE, the default font is encoding specific).
// 4027 is the (xMax - xMin) value in the "head" font table for MS Shell Dlg.
if (family == "Lucida Grande")
maxCharWidth = scaleEmToUnits(4027);
- else if (style().font().hasValidAverageCharWidth())
- maxCharWidth = roundf(style().font().primaryFontData().maxCharWidth());
+ else if (style().fontCascade().hasValidAverageCharWidth())
+ maxCharWidth = roundf(style().fontCascade().primaryFontData().maxCharWidth());
#endif
// For text inputs, IE adds some extra width.
case ButtonPart: {
// Border
LengthBox borderBox(style.borderTopWidth(), style.borderRightWidth(), style.borderBottomWidth(), style.borderLeftWidth());
- borderBox = m_theme->controlBorder(part, style.font(), borderBox, style.effectiveZoom());
+ borderBox = m_theme->controlBorder(part, style.fontCascade(), borderBox, style.effectiveZoom());
if (borderBox.top().value() != static_cast<int>(style.borderTopWidth())) {
if (borderBox.top().value())
style.setBorderTopWidth(borderBox.top().value());
}
// Padding
- LengthBox paddingBox = m_theme->controlPadding(part, style.font(), style.paddingBox(), style.effectiveZoom());
+ LengthBox paddingBox = m_theme->controlPadding(part, style.fontCascade(), style.paddingBox(), style.effectiveZoom());
if (paddingBox != style.paddingBox())
style.setPaddingBox(paddingBox);
// Width / Height
// The width and height here are affected by the zoom.
// FIXME: Check is flawed, since it doesn't take min-width/max-width into account.
- LengthSize controlSize = m_theme->controlSize(part, style.font(), LengthSize(style.width(), style.height()), style.effectiveZoom());
+ LengthSize controlSize = m_theme->controlSize(part, style.fontCascade(), LengthSize(style.width(), style.height()), style.effectiveZoom());
if (controlSize.width() != style.width())
style.setWidth(controlSize.width());
if (controlSize.height() != style.height())
style.setHeight(controlSize.height());
// Min-Width / Min-Height
- LengthSize minControlSize = m_theme->minimumControlSize(part, style.font(), style.effectiveZoom());
+ LengthSize minControlSize = m_theme->minimumControlSize(part, style.fontCascade(), style.effectiveZoom());
if (minControlSize.width() != style.minWidth())
style.setMinWidth(minControlSize.width());
if (minControlSize.height() != style.minHeight())
style.setMinHeight(minControlSize.height());
// Font
- FontDescription controlFont = m_theme->controlFont(part, style.font(), style.effectiveZoom());
- if (controlFont != style.font().fontDescription()) {
+ FontDescription controlFont = m_theme->controlFont(part, style.fontCascade(), style.effectiveZoom());
+ if (controlFont != style.fontCascade().fontDescription()) {
// Now update our font.
if (style.setFontDescription(controlFont))
- style.font().update(0);
+ style.fontCascade().update(0);
}
// Reset our line-height
style.setLineHeight(RenderStyle::initialLineHeight());
return fileButtonNoFileSelectedLabel();
}
-String RenderTheme::fileListNameForWidth(const FileList* fileList, const Font& font, int width, bool multipleFilesAllowed) const
+String RenderTheme::fileListNameForWidth(const FileList* fileList, const FontCascade& font, int width, bool multipleFilesAllowed) const
{
if (width <= 0)
return String();
virtual bool popsMenuBySpaceOrReturn() const { return false; }
virtual String fileListDefaultLabel(bool multipleFilesAllowed) const;
- virtual String fileListNameForWidth(const FileList*, const Font&, int width, bool multipleFilesAllowed) const;
+ virtual String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const;
enum FileUploadDecorations { SingleFile, MultipleFiles };
virtual bool paintFileUploadIconDecorations(const RenderObject& /*inputRenderer*/, const RenderObject& /*buttonRenderer*/, const PaintInfo&, const IntRect&, Icon*, FileUploadDecorations) { return true; }
return progressRect;
}
-String RenderThemeGtk::fileListNameForWidth(const FileList* fileList, const Font& font, int width, bool multipleFilesAllowed) const
+String RenderThemeGtk::fileListNameForWidth(const FileList* fileList, const FontCascade& font, int width, bool multipleFilesAllowed) const
{
if (width <= 0)
return String();
virtual void adjustInnerSpinButtonStyle(StyleResolver&, RenderStyle&, Element*) const override;
virtual bool paintInnerSpinButton(const RenderObject&, const PaintInfo&, const IntRect&) override;
- virtual String fileListNameForWidth(const FileList*, const Font&, int width, bool multipleFilesAllowed) const override;
+ virtual String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const override;
static void setTextInputBorders(RenderStyle&);
#import "DateComponents.h"
#import "Document.h"
#import "FloatRoundedRect.h"
-#import "Font.h"
#import "FontCache.h"
+#import "FontCascade.h"
#import "Frame.h"
#import "FrameView.h"
#import "Gradient.h"
class RenderThemeMeasureTextClient : public MeasureTextClient {
public:
- RenderThemeMeasureTextClient(const Font& font, RenderObject& renderObject, const RenderStyle& style)
+ RenderThemeMeasureTextClient(const FontCascade& font, RenderObject& renderObject, const RenderStyle& style)
: m_font(font)
, m_renderObject(renderObject)
, m_style(style)
return m_font.width(run);
}
private:
- const Font& m_font;
+ const FontCascade& m_font;
RenderObject& m_renderObject;
const RenderStyle& m_style;
};
return;
// Enforce the width and set the box-sizing to content-box to not conflict with the padding.
- Font font = style.font();
+ FontCascade font = style.fontCascade();
RenderObject* renderer = inputElement.renderer();
if (font.primaryFontData().isSVGFont() && !renderer)
virtual bool paintSnapshottedPluginOverlay(const RenderObject&, const PaintInfo&, const IntRect&) override;
private:
- virtual String fileListNameForWidth(const FileList*, const Font&, int width, bool multipleFilesAllowed) const override;
+ virtual String fileListNameForWidth(const FileList*, const FontCascade&, int width, bool multipleFilesAllowed) const override;
FloatRect convertToPaintingRect(const RenderObject& inputRenderer, const RenderObject& partRenderer, const FloatRect& inputRect, const IntRect&) const;
style.setLineHeight(RenderStyle::initialLineHeight());
if (style.setFontDescription(fontDescription))
- style.font().update(0);
+ style.fontCascade().update(0);
}
NSControlSize RenderThemeMac::controlSizeForSystemFont(RenderStyle& style) const
return m_textField.get();
}
-String RenderThemeMac::fileListNameForWidth(const FileList* fileList, const Font& font, int width, bool multipleFilesAllowed) const
+String RenderThemeMac::fileListNameForWidth(const FileList* fileList, const FontCascade& font, int width, bool multipleFilesAllowed) const
{
if (width <= 0)
return String();
const RenderStyle& boxLineStyle = box.lineStyle();
if (usedFonts && !usedFonts->isEmpty() && (includeFont || (boxLineStyle.lineHeight().isNegative() && includeLeading))) {
- usedFonts->append(&boxLineStyle.font().primaryFontData());
+ usedFonts->append(&boxLineStyle.fontCascade().primaryFontData());
for (size_t i = 0; i < usedFonts->size(); ++i) {
const FontMetrics& fontMetrics = usedFonts->at(i)->fontMetrics();
int usedFontAscent = fontMetrics.ascent(baselineType());
if (verticalAlign != BASELINE) {
const RenderStyle& parentLineStyle = firstLine ? parent->firstLineStyle() : parent->style();
- const Font& font = parentLineStyle.font();
+ const FontCascade& font = parentLineStyle.fontCascade();
const FontMetrics& fontMetrics = font.fontMetrics();
int fontSize = font.pixelSize();
}
}
}
- if (style.font().primaryFontData().isSVGFont())
+ if (style.fontCascade().primaryFontData().isSVGFont())
return false;
// We assume that all lines have metrics based purely on the primary font.
- auto& primaryFontData = style.font().primaryFontData();
+ auto& primaryFontData = style.fontCascade().primaryFontData();
if (primaryFontData.isLoading())
return false;
for (const auto& textRenderer : childrenOfType<RenderText>(flow)) {
if (textRenderer.isCombineText() || textRenderer.isCounter() || textRenderer.isQuote() || textRenderer.isTextFragment()
|| textRenderer.isSVGInlineText())
return false;
- if (style.font().codePath(TextRun(textRenderer.text())) != Font::Simple)
+ if (style.fontCascade().codePath(TextRun(textRenderer.text())) != FontCascade::Simple)
return false;
if (!canUseForText(textRenderer, primaryFontData))
return false;
namespace SimpleLineLayout {
FlowContents::Style::Style(const RenderStyle& style)
- : font(style.font())
+ : font(style.fontCascade())
, textAlign(style.textAlign())
, collapseWhitespace(style.collapseWhiteSpace())
, preserveNewline(style.preserveNewline())
#ifndef SimpleLineLayoutFlowContents_h
#define SimpleLineLayoutFlowContents_h
-#include "Font.h"
+#include "FontCascade.h"
#include "RenderStyle.h"
#include "TextBreakIterator.h"
#include "break_lines.h"
struct Style {
explicit Style(const RenderStyle&);
- const Font& font;
+ const FontCascade& font;
ETextAlign textAlign;
bool collapseWhitespace;
bool preserveNewline;
bool debugBordersEnabled = flow.frame().settings().simpleLineLayoutDebugBordersEnabled();
GraphicsContext& context = *paintInfo.context;
- const Font& font = style.font();
+ const FontCascade& font = style.fontCascade();
TextPaintStyle textPaintStyle = computeTextPaintStyle(flow.frame(), style, paintInfo);
GraphicsContextStateSaver stateSaver(context, textPaintStyle.strokeWidth > 0);
, m_lineHeight(lineHeightFromFlow(flow))
, m_baseline(baselineFromFlow(flow))
, m_borderAndPaddingBefore(flow.borderAndPaddingBefore())
- , m_ascent(flow.style().font().fontMetrics().ascent())
- , m_descent(flow.style().font().fontMetrics().descent())
+ , m_ascent(flow.style().fontCascade().fontMetrics().ascent())
+ , m_descent(flow.style().fontCascade().fontMetrics().descent())
{
}
FontDescription fontDescription = style->fontDescription();
fontDescription.setComputedSize(averageSize);
style->setFontDescription(fontDescription);
- style->font().update(autoSizingNode->document().ensureStyleResolver().fontSelector());
+ style->fontCascade().update(autoSizingNode->document().ensureStyleResolver().fontSelector());
text->parent()->setStyle(style.releaseNonNull());
RenderElement* parentRenderer = text->parent();
if (listMarkerRenderer->isListMarker()) {
RefPtr<RenderStyle> style = cloneRenderStyleWithState(listMarkerRenderer->style());
style->setFontDescription(fontDescription);
- style->font().update(autoSizingNode->document().ensureStyleResolver().fontSelector());
+ style->fontCascade().update(autoSizingNode->document().ensureStyleResolver().fontSelector());
downcast<RenderListMarker>(*listMarkerRenderer).setStyle(style.releaseNonNull());
}
newParentStyle->setLineHeight(Length(lineHeight, Fixed));
newParentStyle->setSpecifiedLineHeight(lineHeightLength);
newParentStyle->setFontDescription(fontDescription);
- newParentStyle->font().update(autoSizingNode->document().ensureStyleResolver().fontSelector());
+ newParentStyle->fontCascade().update(autoSizingNode->document().ensureStyleResolver().fontSelector());
parentRenderer->setStyle(newParentStyle.releaseNonNull());
}
}
fontDescription.setComputedSize(originalSize);
RefPtr<RenderStyle> style = cloneRenderStyleWithState(text->style());
style->setFontDescription(fontDescription);
- style->font().update(autoSizingNode->document().ensureStyleResolver().fontSelector());
+ style->fontCascade().update(autoSizingNode->document().ensureStyleResolver().fontSelector());
text->parent()->setStyle(style.releaseNonNull());
}
// Reset the line height of the parent.
RefPtr<RenderStyle> newParentStyle = cloneRenderStyleWithState(parentStyle);
newParentStyle->setLineHeight(originalLineHeight);
newParentStyle->setFontDescription(fontDescription);
- newParentStyle->font().update(autoSizingNode->document().ensureStyleResolver().fontSelector());
+ newParentStyle->fontCascade().update(autoSizingNode->document().ensureStyleResolver().fontSelector());
parentRenderer->setStyle(newParentStyle.releaseNonNull());
}
}
namespace WebCore {
-TextPainter::TextPainter(GraphicsContext& context, bool paintSelectedTextOnly, bool paintSelectedTextSeparately, const Font& font,
+TextPainter::TextPainter(GraphicsContext& context, bool paintSelectedTextOnly, bool paintSelectedTextSeparately, const FontCascade& font,
int startPositionInTextRun, int endPositionInTextBoxString, int length, const AtomicString& emphasisMark, RenderCombineText* combinedText, TextRun& textRun,
FloatRect& boxRect, FloatPoint& textOrigin, int emphasisMarkOffset, const ShadowData* textShadow, const ShadowData* selectionShadow,
bool textBoxIsHorizontal, TextPaintStyle& textPaintStyle, TextPaintStyle& selectionPaintStyle)
{
}
-static void drawTextOrEmphasisMarks(GraphicsContext& context, const Font& font, const TextRun& textRun, const AtomicString& emphasisMark,
+static void drawTextOrEmphasisMarks(GraphicsContext& context, const FontCascade& font, const TextRun& textRun, const AtomicString& emphasisMark,
int emphasisMarkOffset, const FloatPoint& point, const int from, const int to)
{
if (emphasisMark.isEmpty())
m_context.clearShadow();
}
-static void paintTextWithShadows(GraphicsContext& context, const Font& font, const TextRun& textRun, const AtomicString& emphasisMark,
+static void paintTextWithShadows(GraphicsContext& context, const FontCascade& font, const TextRun& textRun, const AtomicString& emphasisMark,
int emphasisMarkOffset, int startOffset, int endOffset, int truncationPoint, const FloatPoint& textOrigin, const FloatRect& boxRect,
const ShadowData* shadow, bool stroked, bool horizontal)
{
class TextPainter {
public:
- TextPainter(GraphicsContext&, bool paintSelectedTextOnly, bool paintSelectedTextSeparately, const Font&,
+ TextPainter(GraphicsContext&, bool paintSelectedTextOnly, bool paintSelectedTextSeparately, const FontCascade&,
int startPositionInTextRun, int endPositionInTextBoxString, int length, const AtomicString& emphasisMark, RenderCombineText*,
TextRun&, FloatRect& boxRect, FloatPoint& textOrigin, int emphasisMarkOffset, const ShadowData* textShadow, const ShadowData* selectionShadow,
bool textBoxIsHorizontal, TextPaintStyle& nonSelectionPaintStyle, TextPaintStyle& selectionPaintStyle);
const ShadowData* m_selectionShadow;
bool m_paintSelectedTextOnly;
bool m_paintSelectedTextSeparately;
- const Font& m_font;
+ const FontCascade& m_font;
int m_startPositionInTextRun;
int m_endPositionInTextRun;
int m_length;
downcast<RenderCounter>(renderText).updateCounter();
}
-inline float measureHyphenWidth(RenderText* renderer, const Font& font, HashSet<const SimpleFontData*>* fallbackFonts = 0)
+inline float measureHyphenWidth(RenderText* renderer, const FontCascade& font, HashSet<const SimpleFontData*>* fallbackFonts = 0)
{
const RenderStyle& style = renderer->style();
return font.width(RenderBlock::constructTextRun(renderer, font, style.hyphenString().string(), style), fallbackFonts);
}
-ALWAYS_INLINE float textWidth(RenderText* text, unsigned from, unsigned len, const Font& font, float xPos, bool isFixedPitch, bool collapseWhiteSpace, HashSet<const SimpleFontData*>& fallbackFonts, TextLayout* layout = 0)
+ALWAYS_INLINE float textWidth(RenderText* text, unsigned from, unsigned len, const FontCascade& font, float xPos, bool isFixedPitch, bool collapseWhiteSpace, HashSet<const SimpleFontData*>& fallbackFonts, TextLayout* layout = 0)
{
const RenderStyle& style = text->style();
return text->width(from, len, font, xPos, &fallbackFonts, &glyphOverflow);
if (layout)
- return Font::width(*layout, from, len, &fallbackFonts);
+ return FontCascade::width(*layout, from, len, &fallbackFonts);
TextRun run = RenderBlock::constructTextRun(text, font, text, from, len, style);
run.setCharactersLength(text->textLength() - from);
lineMidpointState.stopIgnoringSpaces(InlineIterator(0, textParagraphSeparator.renderer(), textParagraphSeparator.offset()));
}
-inline void tryHyphenating(RenderText* text, const Font& font, const AtomicString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated)
+inline void tryHyphenating(RenderText* text, const FontCascade& font, const AtomicString& localeIdentifier, unsigned consecutiveHyphenatedLines, int consecutiveHyphenatedLinesLimit, int minimumPrefixLimit, int minimumSuffixLimit, unsigned lastSpace, unsigned pos, float xPos, int availableWidth, bool isFixedPitch, bool collapseWhiteSpace, int lastSpaceWordSpacing, InlineIterator& lineBreak, int nextBreakable, bool& hyphenated)
{
// Map 'hyphenate-limit-{before,after}: auto;' to 2.
unsigned minimumPrefixLength;
}
const RenderStyle& style = lineStyle(*renderText.parent(), m_lineInfo);
- const Font& font = style.font();
+ const FontCascade& font = style.fontCascade();
bool isFixedPitch = font.isFixedPitch();
bool canHyphenate = style.hyphens() == HyphensAuto && WebCore::canHyphenate(style.locale());
unsigned lastSpace = m_current.offset();
- float wordSpacing = m_currentStyle->font().wordSpacing();
+ float wordSpacing = m_currentStyle->fontCascade().wordSpacing();
float lastSpaceWordSpacing = 0;
float wordSpacingForWordMeasurement = 0;
RenderText* m_text;
OwnPtr<TextLayout> m_layout;
LazyLineBreakIterator m_lineBreakIterator;
- const Font* m_font;
+ const FontCascade* m_font;
};
class LineBreaker {
const RenderStyle& parentStyle = lineStyle(*parent, lineInfo);
if (flowStyle.lineHeight() != parentStyle.lineHeight()
|| flowStyle.verticalAlign() != parentStyle.verticalAlign()
- || !parentStyle.font().fontMetrics().hasIdenticalAscentDescentAndLineGap(flowStyle.font().fontMetrics()))
+ || !parentStyle.fontCascade().fontMetrics().hasIdenticalAscentDescentAndLineGap(flowStyle.fontCascade().fontMetrics()))
return true;
}
return false;
return true;
}
if (unit == "em") {
- lengthValue = floatValue * style->font().size();
+ lengthValue = floatValue * style->fontCascade().size();
return true;
}
if (unit == "ex") {
length = -7;
}
if (length) {
- lengthValue = length * style->font().size() / 18;
+ lengthValue = length * style->fontCascade().size() / 18;
return true;
}
return false;
m_operatorFlags = entry->flags;
// Leading and trailing space is specified as multiple of 1/18em.
- m_leadingSpace = entry->lspace * style().font().size() / 18;
- m_trailingSpace = entry->rspace * style().font().size() / 18;
+ m_leadingSpace = entry->lspace * style().fontCascade().size() / 18;
+ m_trailingSpace = entry->rspace * style().fontCascade().size() / 18;
}
void RenderMathMLOperator::setOperatorProperties()
m_operatorFlags &= MathMLOperatorDictionary::Fence | MathMLOperatorDictionary::Separator; // This resets all but the Fence and Separator properties.
else
m_operatorFlags = 0; // This resets all the operator properties.
- m_leadingSpace = 5 * style().font().size() / 18; // This sets leading space to "thickmathspace".
- m_trailingSpace = 5 * style().font().size() / 18; // This sets trailing space to "thickmathspace".
- m_minSize = style().font().size(); // This sets minsize to "1em".
+ m_leadingSpace = 5 * style().fontCascade().size() / 18; // This sets leading space to "thickmathspace".
+ m_trailingSpace = 5 * style().fontCascade().size() / 18; // This sets trailing space to "thickmathspace".
+ m_minSize = style().fontCascade().size(); // This sets minsize to "1em".
m_maxSize = intMaxForLayoutUnit; // This sets maxsize to "infinity".
if (m_textContent) {
RenderMathMLToken::computePreferredLogicalWidths();
if (isInvisibleOperator()) {
// In some fonts, glyphs for invisible operators have nonzero width. Consequently, we subtract that width here to avoid wide gaps.
- GlyphData data = style().font().glyphDataForCharacter(m_textContent, false);
+ GlyphData data = style().fontCascade().glyphDataForCharacter(m_textContent, false);
float glyphWidth = advanceForGlyph(data);
ASSERT(glyphWidth <= m_minPreferredLogicalWidth);
m_minPreferredLogicalWidth -= glyphWidth;
return;
}
- GlyphData data = style().font().glyphDataForCharacter(m_textContent, !style().isLeftToRightDirection());
+ GlyphData data = style().fontCascade().glyphDataForCharacter(m_textContent, !style().isLeftToRightDirection());
float maximumGlyphWidth = advanceForGlyph(data);
if (!m_isVertical) {
if (maximumGlyphWidth < stretchSize())
if (!bottom.glyph)
bottom.glyph = extension.glyph;
- top.fontData = &style().font().primaryFontData();
+ top.fontData = &style().fontCascade().primaryFontData();
extension.fontData = top.fontData;
bottom.fontData = top.fontData;
if (middle.glyph)
ASSERT(m_isVertical && isLargeOperatorInDisplayStyle());
- const auto& primaryFontData = style().font().primaryFontData();
- GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection());
+ const auto& primaryFontData = style().fontCascade().primaryFontData();
+ GlyphData baseGlyph = style().fontCascade().glyphDataForCharacter(character, !style().isLeftToRightDirection());
if (!primaryFontData.mathData() || baseGlyph.fontData != &primaryFontData)
return data;
StretchyData data;
StretchyData assemblyData;
- const auto& primaryFontData = style().font().primaryFontData();
- GlyphData baseGlyph = style().font().glyphDataForCharacter(character, !style().isLeftToRightDirection());
+ const auto& primaryFontData = style().fontCascade().primaryFontData();
+ GlyphData baseGlyph = style().fontCascade().glyphDataForCharacter(character, !style().isLeftToRightDirection());
if (primaryFontData.mathData() && baseGlyph.fontData == &primaryFontData) {
Vector<Glyph> sizeVariants;
return data;
// We convert the list of Unicode characters into a list of glyph data.
- GlyphData top = style().font().glyphDataForCharacter(stretchyCharacter->topChar, false);
- GlyphData extension = style().font().glyphDataForCharacter(stretchyCharacter->extensionChar, false);
- GlyphData bottom = style().font().glyphDataForCharacter(stretchyCharacter->bottomChar, false);
+ GlyphData top = style().fontCascade().glyphDataForCharacter(stretchyCharacter->topChar, false);
+ GlyphData extension = style().fontCascade().glyphDataForCharacter(stretchyCharacter->extensionChar, false);
+ GlyphData bottom = style().fontCascade().glyphDataForCharacter(stretchyCharacter->bottomChar, false);
GlyphData middle;
if (stretchyCharacter->middleChar)
- middle = style().font().glyphDataForCharacter(stretchyCharacter->middleChar, false);
+ middle = style().fontCascade().glyphDataForCharacter(stretchyCharacter->middleChar, false);
assemblyData.setGlyphAssemblyMode(top, extension, bottom, middle);
}
m_stretchyData = getDisplayStyleLargeOperator(m_textContent);
else {
// We do not stretch if the base glyph is large enough.
- GlyphData baseGlyph = style().font().glyphDataForCharacter(m_textContent, !style().isLeftToRightDirection());
+ GlyphData baseGlyph = style().fontCascade().glyphDataForCharacter(m_textContent, !style().isLeftToRightDirection());
float baseSize = m_isVertical ? heightForGlyph(baseGlyph) : advanceForGlyph(baseGlyph);
if (stretchSize() <= baseSize)
return;
GlyphBuffer buffer;
buffer.add(data.glyph, data.fontData, advanceForGlyph(data));
- info.context->drawGlyphs(style().font(), *data.fontData, buffer, 0, 1, origin);
+ info.context->drawGlyphs(style().fontCascade(), *data.fontData, buffer, 0, 1, origin);
return glyphPaintRect;
}
LayoutPoint operatorTopLeft = ceiledIntPoint(paintOffset + location());
FloatRect glyphBounds = boundsForGlyph(m_stretchyData.variant());
LayoutPoint operatorOrigin(operatorTopLeft.x(), operatorTopLeft.y() - glyphBounds.y());
- info.context->drawGlyphs(style().font(), *m_stretchyData.variant().fontData, buffer, 0, 1, operatorOrigin);
+ info.context->drawGlyphs(style().fontCascade(), *m_stretchyData.variant().fontData, buffer, 0, 1, operatorOrigin);
return;
}
LayoutUnit RenderMathMLOperator::trailingSpaceError()
{
- const auto& primaryFontData = style().font().primaryFontData();
+ const auto& primaryFontData = style().fontCascade().primaryFontData();
if (!primaryFontData.mathData())
return 0;
LayoutUnit width = logicalWidth();
if (m_stretchyData.mode() == DrawNormal) {
- GlyphData data = style().font().glyphDataForCharacter(textContent(), !style().isLeftToRightDirection());
+ GlyphData data = style().fontCascade().glyphDataForCharacter(textContent(), !style().isLeftToRightDirection());
return width - advanceForGlyph(data);
}
void RenderMathMLRadicalOperator::stretchTo(LayoutUnit heightAboveBaseline, LayoutUnit depthBelowBaseline)
{
- if (!style().font().primaryFontData().mathData()) {
+ if (!style().fontCascade().primaryFontData().mathData()) {
// If we do not have an OpenType MATH font, we always make the radical depth a bit larger than the target.
depthBelowBaseline += gRadicalBottomPointLower;
}
{
ASSERT(preferredLogicalWidthsDirty());
- if (style().font().primaryFontData().mathData()) {
+ if (style().fontCascade().primaryFontData().mathData()) {
RenderMathMLOperator::computePreferredLogicalWidths();
return;
}
void RenderMathMLRadicalOperator::computeLogicalHeight(LayoutUnit logicalHeight, LayoutUnit logicalTop, LogicalExtentComputedValues& computedValues) const
{
- if (style().font().primaryFontData().mathData()) {
+ if (style().fontCascade().primaryFontData().mathData()) {
RenderMathMLOperator::computeLogicalHeight(logicalHeight, logicalTop, computedValues);
return;
}
if (info.context->paintingDisabled() || info.phase != PaintPhaseForeground || style().visibility() != VISIBLE)
return;
- if (style().font().primaryFontData().mathData()) {
+ if (style().fontCascade().primaryFontData().mathData()) {
RenderMathMLOperator::paint(info, paintOffset);
return;
}
// We set some constants to draw the radical, as defined in the OpenType MATH tables.
- m_ruleThickness = 0.05f * style().font().size();
+ m_ruleThickness = 0.05f * style().fontCascade().size();
// FIXME: The recommended default for m_verticalGap in displaystyle is rule thickness + 1/4 x-height (https://bugs.webkit.org/show_bug.cgi?id=118737).
m_verticalGap = 11 * m_ruleThickness / 4;
m_extraAscender = m_ruleThickness;
- LayoutUnit kernBeforeDegree = 5 * style().font().size() / 18;
- LayoutUnit kernAfterDegree = -10 * style().font().size() / 18;
+ LayoutUnit kernBeforeDegree = 5 * style().fontCascade().size() / 18;
+ LayoutUnit kernAfterDegree = -10 * style().fontCascade().size() / 18;
m_degreeBottomRaisePercent = 0.6f;
- const auto& primaryFontData = style().font().primaryFontData();
- if (auto* mathData = style().font().primaryFontData().mathData()) {
+ const auto& primaryFontData = style().fontCascade().primaryFontData();
+ if (auto* mathData = style().fontCascade().primaryFontData().mathData()) {
// FIXME: m_verticalGap should use RadicalDisplayStyleVertical in display mode (https://bugs.webkit.org/show_bug.cgi?id=118737).
m_verticalGap = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalVerticalGap);
m_ruleThickness = mathData->getMathConstant(primaryFontData, OpenTypeMathData::RadicalRuleThickness);
// This tries to emulate the default mathvariant value on <mi> using the CSS font-style property.
// FIXME: This should be revised when mathvariant is implemented (http://wkbug/85735) and when fonts with Mathematical Alphanumeric Symbols characters are more popular.
FontDescription fontDescription(newStyle.get().fontDescription());
- FontSelector* fontSelector = newStyle.get().font().fontSelector();
+ FontSelector* fontSelector = newStyle.get().fontCascade().fontSelector();
if (!m_containsElement && element().textContent().stripWhiteSpace().simplifyWhiteSpace().length() == 1&nb