summaryrefslogtreecommitdiffstats
path: root/WebCore/css/CSSStyleSelector.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/css/CSSStyleSelector.cpp')
-rw-r--r--WebCore/css/CSSStyleSelector.cpp290
1 files changed, 233 insertions, 57 deletions
diff --git a/WebCore/css/CSSStyleSelector.cpp b/WebCore/css/CSSStyleSelector.cpp
index 9074476..69c5598 100644
--- a/WebCore/css/CSSStyleSelector.cpp
+++ b/WebCore/css/CSSStyleSelector.cpp
@@ -408,7 +408,9 @@ static const MediaQueryEvaluator& printEval()
return staticPrintEval;
}
-CSSStyleSelector::CSSStyleSelector(Document* doc, const String& userStyleSheet, StyleSheetList* styleSheets, CSSStyleSheet* mappedElementSheet, bool strictParsing, bool matchAuthorAndUserStyles)
+CSSStyleSelector::CSSStyleSelector(Document* doc, StyleSheetList* styleSheets, CSSStyleSheet* mappedElementSheet,
+ CSSStyleSheet* pageUserSheet, const Vector<RefPtr<CSSStyleSheet> >* pageGroupUserSheets,
+ bool strictParsing, bool matchAuthorAndUserStyles)
: m_backgroundData(BackgroundFillLayer)
, m_checker(doc, strictParsing)
, m_fontSelector(CSSFontSelector::create(doc))
@@ -449,12 +451,15 @@ CSSStyleSelector::CSSStyleSelector(Document* doc, const String& userStyleSheet,
}
// FIXME: This sucks! The user sheet is reparsed every time!
- if (!userStyleSheet.isEmpty()) {
- m_userSheet = CSSStyleSheet::create(doc);
- m_userSheet->parseString(userStyleSheet, strictParsing);
-
+ if (pageUserSheet || pageGroupUserSheets) {
m_userStyle = new CSSRuleSet();
- m_userStyle->addRulesFromSheet(m_userSheet.get(), *m_medium, this);
+ if (pageUserSheet)
+ m_userStyle->addRulesFromSheet(pageUserSheet, *m_medium, this);
+ if (pageGroupUserSheets) {
+ unsigned length = pageGroupUserSheets->size();
+ for (unsigned i = 0; i < length; i++)
+ m_userStyle->addRulesFromSheet(pageGroupUserSheets->at(i).get(), *m_medium, this);
+ }
}
// add stylesheets from document
@@ -995,6 +1000,13 @@ bool CSSStyleSelector::canShareStyleWithElement(Node* n)
if (s->isEnabledFormControl() != m_element->isEnabledFormControl())
return false;
+
+ if (s->isDefaultButtonForForm() != m_element->isDefaultButtonForForm())
+ return false;
+
+ if ((s->willValidate() && s->isValidFormControlElement()) !=
+ (m_element->willValidate() && m_element->isValidFormControlElement()))
+ return false;
}
if (style->transitions() || style->animations())
@@ -1127,6 +1139,17 @@ PassRefPtr<RenderStyle> CSSStyleSelector::styleForElement(Element* e, RenderStyl
}
#endif
+#if ENABLE(MATHML)
+ static bool loadedMathMLUserAgentSheet;
+ if (e->isMathMLElement() && !loadedMathMLUserAgentSheet) {
+ // MathML rules.
+ loadedMathMLUserAgentSheet = true;
+ CSSStyleSheet* mathMLSheet = parseUASheet(mathmlUserAgentStyleSheet, sizeof(mathmlUserAgentStyleSheet));
+ defaultStyle->addRulesFromSheet(mathMLSheet, screenEval());
+ defaultPrintStyle->addRulesFromSheet(mathMLSheet, printEval());
+ }
+#endif
+
#if ENABLE(WML)
static bool loadedWMLUserAgentSheet;
if (e->isWMLElement() && !loadedWMLUserAgentSheet) {
@@ -2358,6 +2381,8 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
case CSSSelector::PseudoFullPageMedia:
return e && e->document() && e->document()->isMediaDocument();
break;
+ case CSSSelector::PseudoDefault:
+ return e && e->isDefaultButtonForForm();
case CSSSelector::PseudoDisabled:
if (e && e->isFormControlElement()) {
InputElement* inputElement = toInputElement(e);
@@ -2384,6 +2409,10 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
return e && e->isOptionalFormControl();
case CSSSelector::PseudoRequired:
return e && e->isRequiredFormControl();
+ case CSSSelector::PseudoValid:
+ return e && e->willValidate() && e->isValidFormControlElement();
+ case CSSSelector::PseudoInvalid:
+ return e && e->willValidate() && !e->isValidFormControlElement();
case CSSSelector::PseudoChecked: {
if (!e || !e->isFormControlElement())
break;
@@ -2465,6 +2494,11 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
case CSSSelector::PseudoFileUploadButton:
dynamicPseudo = FILE_UPLOAD_BUTTON;
return true;
+#if ENABLE(DATALIST)
+ case CSSSelector::PseudoInputListButton:
+ dynamicPseudo = INPUT_LIST_BUTTON;
+ return true;
+#endif
case CSSSelector::PseudoInputPlaceholder:
dynamicPseudo = INPUT_PLACEHOLDER;
return true;
@@ -2494,7 +2528,10 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
return true;
case CSSSelector::PseudoMediaControlsTimelineContainer:
dynamicPseudo = MEDIA_CONTROLS_TIMELINE_CONTAINER;
- return true;
+ return true;
+ case CSSSelector::PseudoMediaControlsVolumeSliderContainer:
+ dynamicPseudo = MEDIA_CONTROLS_VOLUME_SLIDER_CONTAINER;
+ return true;
case CSSSelector::PseudoMediaControlsCurrentTimeDisplay:
dynamicPseudo = MEDIA_CONTROLS_CURRENT_TIME_DISPLAY;
return true;
@@ -2504,6 +2541,9 @@ bool CSSStyleSelector::SelectorChecker::checkOneSelector(CSSSelector* sel, Eleme
case CSSSelector::PseudoMediaControlsTimeline:
dynamicPseudo = MEDIA_CONTROLS_TIMELINE;
return true;
+ case CSSSelector::PseudoMediaControlsVolumeSlider:
+ dynamicPseudo = MEDIA_CONTROLS_VOLUME_SLIDER;
+ return true;
case CSSSelector::PseudoMediaControlsSeekBackButton:
dynamicPseudo = MEDIA_CONTROLS_SEEK_BACK_BUTTON;
return true;
@@ -2920,10 +2960,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
case CSSPropertyWebkitBackgroundOrigin:
HANDLE_BACKGROUND_VALUE(origin, Origin, value)
return;
- case CSSPropertyBackgroundRepeat:
- HANDLE_BACKGROUND_VALUE(repeat, Repeat, value)
- return;
- case CSSPropertyWebkitBackgroundSize:
+ case CSSPropertyBackgroundSize:
HANDLE_BACKGROUND_VALUE(size, Size, value)
return;
case CSSPropertyWebkitMaskAttachment:
@@ -2938,9 +2975,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
case CSSPropertyWebkitMaskOrigin:
HANDLE_MASK_VALUE(origin, Origin, value)
return;
- case CSSPropertyWebkitMaskRepeat:
- HANDLE_MASK_VALUE(repeat, Repeat, value)
- return;
case CSSPropertyWebkitMaskSize:
HANDLE_MASK_VALUE(size, Size, value)
return;
@@ -2991,6 +3025,26 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
return;
case CSSPropertyDisplay:
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(display, Display)
+#if ENABLE(WCSS)
+ if (primitiveValue) {
+ if (primitiveValue->getIdent() == CSSValueWapMarquee) {
+ // Initialize Wap Marquee style
+ m_style->setOverflowX(OMARQUEE);
+ m_style->setOverflowY(OMARQUEE);
+ m_style->setWhiteSpace(NOWRAP);
+ m_style->setMarqueeDirection(MLEFT);
+ m_style->setMarqueeSpeed(85); // Normal speed
+ m_style->setMarqueeLoopCount(1);
+ m_style->setMarqueeBehavior(MSCROLL);
+
+ if (m_parentStyle)
+ m_style->setDisplay(m_parentStyle->display());
+ else
+ m_style->setDisplay(*primitiveValue);
+ } else
+ m_style->setDisplay(*primitiveValue);
+ }
+#endif
return;
case CSSPropertyEmptyCells:
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(emptyCells, EmptyCells)
@@ -3207,6 +3261,26 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
HANDLE_MASK_VALUE(yPosition, YPosition, value)
return;
}
+ case CSSPropertyBackgroundRepeat:
+ HANDLE_BACKGROUND_INHERIT_AND_INITIAL(repeatX, RepeatX);
+ HANDLE_BACKGROUND_INHERIT_AND_INITIAL(repeatY, RepeatY);
+ return;
+ case CSSPropertyBackgroundRepeatX:
+ HANDLE_BACKGROUND_VALUE(repeatX, RepeatX, value)
+ return;
+ case CSSPropertyBackgroundRepeatY:
+ HANDLE_BACKGROUND_VALUE(repeatY, RepeatY, value)
+ return;
+ case CSSPropertyWebkitMaskRepeat:
+ HANDLE_MASK_INHERIT_AND_INITIAL(repeatX, RepeatX);
+ HANDLE_MASK_INHERIT_AND_INITIAL(repeatY, RepeatY);
+ return;
+ case CSSPropertyWebkitMaskRepeatX:
+ HANDLE_MASK_VALUE(repeatX, RepeatX, value)
+ return;
+ case CSSPropertyWebkitMaskRepeatY:
+ HANDLE_MASK_VALUE(repeatY, RepeatY, value)
+ return;
case CSSPropertyBorderSpacing: {
if (isInherit) {
m_style->setHorizontalBorderSpacing(m_parentStyle->horizontalBorderSpacing());
@@ -3437,6 +3511,41 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
return;
}
+ case CSSPropertyWebkitFontSmoothing: {
+ FontDescription fontDescription = m_style->fontDescription();
+ if (isInherit)
+ fontDescription.setFontSmoothing(m_parentStyle->fontDescription().fontSmoothing());
+ else if (isInitial)
+ fontDescription.setFontSmoothing(AutoSmoothing);
+ else {
+ if (!primitiveValue)
+ return;
+ int id = primitiveValue->getIdent();
+ FontSmoothingMode smoothing;
+ switch (id) {
+ case CSSValueAuto:
+ smoothing = AutoSmoothing;
+ break;
+ case CSSValueNone:
+ smoothing = NoSmoothing;
+ break;
+ case CSSValueAntialiased:
+ smoothing = Antialiased;
+ break;
+ case CSSValueSubpixelAntialiased:
+ smoothing = SubpixelAntialiased;
+ break;
+ default:
+ ASSERT_NOT_REACHED();
+ smoothing = AutoSmoothing;
+ }
+ fontDescription.setFontSmoothing(smoothing);
+ }
+ if (m_style->setFontDescription(fontDescription))
+ m_fontDirty = true;
+ return;
+ }
+
case CSSPropertyLetterSpacing:
case CSSPropertyWordSpacing:
{
@@ -3754,7 +3863,6 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
{
FontDescription fontDescription = m_style->fontDescription();
fontDescription.setKeywordSize(0);
- bool familyIsFixed = fontDescription.genericFamily() == FontDescription::MonospaceFamily;
float oldSize = 0;
float size = 0;
@@ -3769,7 +3877,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
if (m_parentNode)
fontDescription.setKeywordSize(m_parentStyle->fontDescription().keywordSize());
} else if (isInitial) {
- size = fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), familyIsFixed);
+ size = fontSizeForKeyword(CSSValueMedium, m_style->htmlHacks(), fontDescription.useFixedDefaultSize());
fontDescription.setKeywordSize(CSSValueMedium - CSSValueXxSmall + 1);
} else if (primitiveValue->getIdent()) {
// Keywords are being used.
@@ -3782,7 +3890,7 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
case CSSValueXLarge:
case CSSValueXxLarge:
case CSSValueWebkitXxxLarge:
- size = fontSizeForKeyword(primitiveValue->getIdent(), m_style->htmlHacks(), familyIsFixed);
+ size = fontSizeForKeyword(primitiveValue->getIdent(), m_style->htmlHacks(), fontDescription.useFixedDefaultSize());
fontDescription.setKeywordSize(primitiveValue->getIdent() - CSSValueXxSmall + 1);
break;
case CSSValueLarger:
@@ -4025,13 +4133,12 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
if (m_style->setFontDescription(fontDescription))
m_fontDirty = true;
return;
- }
- else if (isInitial) {
+ } else if (isInitial) {
FontDescription initialDesc = FontDescription();
FontDescription fontDescription = m_style->fontDescription();
// We need to adjust the size to account for the generic family change from monospace
// to non-monospace.
- if (fontDescription.keywordSize() && fontDescription.genericFamily() == FontDescription::MonospaceFamily)
+ if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize())
setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), false));
fontDescription.setGenericFamily(initialDesc.genericFamily());
if (!initialDesc.firstFamily().familyIsEmpty())
@@ -4041,21 +4148,23 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
return;
}
- if (!value->isValueList()) return;
+ if (!value->isValueList())
+ return;
FontDescription fontDescription = m_style->fontDescription();
- CSSValueList *list = static_cast<CSSValueList*>(value);
+ CSSValueList* list = static_cast<CSSValueList*>(value);
int len = list->length();
FontFamily& firstFamily = fontDescription.firstFamily();
- FontFamily *currFamily = 0;
+ FontFamily* currFamily = 0;
// Before mapping in a new font-family property, we should reset the generic family.
- bool oldFamilyIsMonospace = fontDescription.genericFamily() == FontDescription::MonospaceFamily;
+ bool oldFamilyUsedFixedDefaultSize = fontDescription.useFixedDefaultSize();
fontDescription.setGenericFamily(FontDescription::NoFamily);
for (int i = 0; i < len; i++) {
- CSSValue *item = list->itemWithoutBoundsCheck(i);
- if (!item->isPrimitiveValue()) continue;
- CSSPrimitiveValue *val = static_cast<CSSPrimitiveValue*>(item);
+ CSSValue* item = list->itemWithoutBoundsCheck(i);
+ if (!item->isPrimitiveValue())
+ continue;
+ CSSPrimitiveValue* val = static_cast<CSSPrimitiveValue*>(item);
AtomicString face;
Settings* settings = m_checker.m_document->settings();
if (val->primitiveType() == CSSPrimitiveValue::CSS_STRING)
@@ -4087,28 +4196,32 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
break;
}
}
-
+
if (!face.isEmpty()) {
if (!currFamily) {
// Filling in the first family.
firstFamily.setFamily(face);
+ firstFamily.appendFamily(0); // Remove any inherited family-fallback list.
currFamily = &firstFamily;
- }
- else {
+ } else {
RefPtr<SharedFontFamily> newFamily = SharedFontFamily::create();
newFamily->setFamily(face);
currFamily->appendFamily(newFamily);
currFamily = newFamily.get();
}
-
- if (fontDescription.keywordSize() && (fontDescription.genericFamily() == FontDescription::MonospaceFamily) != oldFamilyIsMonospace)
- setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyIsMonospace));
-
- if (m_style->setFontDescription(fontDescription))
- m_fontDirty = true;
}
}
- return;
+
+ // We can't call useFixedDefaultSize() until all new font families have been added
+ // If currFamily is non-zero then we set at least one family on this description.
+ if (currFamily) {
+ if (fontDescription.keywordSize() && fontDescription.useFixedDefaultSize() != oldFamilyUsedFixedDefaultSize)
+ setFontSize(fontDescription, fontSizeForKeyword(CSSValueXxSmall + fontDescription.keywordSize() - 1, m_style->htmlHacks(), !oldFamilyUsedFixedDefaultSize));
+
+ if (m_style->setFontDescription(fontDescription))
+ m_fontDirty = true;
+ }
+ return;
}
case CSSPropertyTextDecoration: {
// list of ident
@@ -4526,9 +4639,23 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
HANDLE_INHERIT_AND_INITIAL(outlineOffset, OutlineOffset)
m_style->setOutlineOffset(primitiveValue->computeLengthInt(style(), m_rootElementStyle, zoomFactor));
return;
-
+ case CSSPropertyTextRendering: {
+ FontDescription fontDescription = m_style->fontDescription();
+ if (isInherit)
+ fontDescription.setTextRenderingMode(m_parentStyle->fontDescription().textRenderingMode());
+ else if (isInitial)
+ fontDescription.setTextRenderingMode(AutoTextRendering);
+ else {
+ if (!primitiveValue)
+ return;
+ fontDescription.setTextRenderingMode(*primitiveValue);
+ }
+ if (m_style->setFontDescription(fontDescription))
+ m_fontDirty = true;
+ return;
+ }
case CSSPropertyTextShadow:
- case CSSPropertyBoxShadow: {
+ case CSSPropertyWebkitBoxShadow: {
if (isInherit) {
if (id == CSSPropertyTextShadow)
return m_style->setTextShadow(m_parentStyle->textShadow() ? new ShadowData(*m_parentStyle->textShadow()) : 0);
@@ -4742,6 +4869,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
m_style->setMarqueeLoopCount(m_parentStyle->marqueeLoopCount());
m_style->setMarqueeBehavior(m_parentStyle->marqueeBehavior());
return;
+#if ENABLE(WCSS)
+ case CSSPropertyWapMarqueeLoop:
+#endif
case CSSPropertyWebkitMarqueeRepetition: {
HANDLE_INHERIT_AND_INITIAL(marqueeLoopCount, MarqueeLoopCount)
if (!primitiveValue)
@@ -4752,6 +4882,9 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
m_style->setMarqueeLoopCount(primitiveValue->getIntValue());
return;
}
+#if ENABLE(WCSS)
+ case CSSPropertyWapMarqueeSpeed:
+#endif
case CSSPropertyWebkitMarqueeSpeed: {
HANDLE_INHERIT_AND_INITIAL(marqueeSpeed, MarqueeSpeed)
if (!primitiveValue)
@@ -4802,9 +4935,30 @@ void CSSStyleSelector::applyProperty(int id, CSSValue *value)
}
return;
}
+#if ENABLE(WCSS)
+ case CSSPropertyWapMarqueeStyle:
+#endif
case CSSPropertyWebkitMarqueeStyle:
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeBehavior, MarqueeBehavior)
return;
+#if ENABLE(WCSS)
+ case CSSPropertyWapMarqueeDir:
+ HANDLE_INHERIT_AND_INITIAL(marqueeDirection, MarqueeDirection)
+ if (primitiveValue && primitiveValue->getIdent()) {
+ switch (primitiveValue->getIdent()) {
+ case CSSValueLtr:
+ m_style->setMarqueeDirection(MRIGHT);
+ break;
+ case CSSValueRtl:
+ m_style->setMarqueeDirection(MLEFT);
+ break;
+ default:
+ m_style->setMarqueeDirection(*primitiveValue);
+ break;
+ }
+ }
+ return;
+#endif
case CSSPropertyWebkitMarqueeDirection:
HANDLE_INHERIT_AND_INITIAL_AND_PRIMITIVE(marqueeDirection, MarqueeDirection)
return;
@@ -5246,10 +5400,10 @@ void CSSStyleSelector::mapFillImage(FillLayer* layer, CSSValue* value)
layer->setImage(styleImage(value));
}
-void CSSStyleSelector::mapFillRepeat(FillLayer* layer, CSSValue* value)
+void CSSStyleSelector::mapFillRepeatX(FillLayer* layer, CSSValue* value)
{
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
- layer->setRepeat(FillLayer::initialFillRepeat(layer->type()));
+ layer->setRepeatX(FillLayer::initialFillRepeatX(layer->type()));
return;
}
@@ -5257,22 +5411,46 @@ void CSSStyleSelector::mapFillRepeat(FillLayer* layer, CSSValue* value)
return;
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
- layer->setRepeat(*primitiveValue);
+ layer->setRepeatX(*primitiveValue);
}
-void CSSStyleSelector::mapFillSize(FillLayer* layer, CSSValue* value)
+void CSSStyleSelector::mapFillRepeatY(FillLayer* layer, CSSValue* value)
{
- LengthSize b = FillLayer::initialFillSize(layer->type());
-
if (value->cssValueType() == CSSValue::CSS_INITIAL) {
- layer->setSize(b);
+ layer->setRepeatY(FillLayer::initialFillRepeatY(layer->type()));
return;
}
if (!value->isPrimitiveValue())
return;
-
+
+ CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+ layer->setRepeatY(*primitiveValue);
+}
+
+void CSSStyleSelector::mapFillSize(FillLayer* layer, CSSValue* value)
+{
+ if (!value->isPrimitiveValue()) {
+ layer->setSizeType(SizeNone);
+ return;
+ }
+
CSSPrimitiveValue* primitiveValue = static_cast<CSSPrimitiveValue*>(value);
+ if (primitiveValue->getIdent() == CSSValueContain)
+ layer->setSizeType(Contain);
+ else if (primitiveValue->getIdent() == CSSValueCover)
+ layer->setSizeType(Cover);
+ else
+ layer->setSizeType(SizeLength);
+
+ LengthSize b = FillLayer::initialFillSizeLength(layer->type());
+
+ if (value->cssValueType() == CSSValue::CSS_INITIAL || primitiveValue->getIdent() == CSSValueContain
+ || primitiveValue->getIdent() == CSSValueCover) {
+ layer->setSizeLength(b);
+ return;
+ }
+
Pair* pair = primitiveValue->getPairValue();
if (!pair)
return;
@@ -5309,7 +5487,7 @@ void CSSStyleSelector::mapFillSize(FillLayer* layer, CSSValue* value)
b.setWidth(firstLength);
b.setHeight(secondLength);
- layer->setSize(b);
+ layer->setSizeLength(b);
}
void CSSStyleSelector::mapFillXPosition(FillLayer* layer, CSSValue* value)
@@ -5587,8 +5765,7 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderSty
return;
const FontDescription& parentFont = parentStyle->fontDescription();
-
- if (childFont.genericFamily() == parentFont.genericFamily())
+ if (childFont.useFixedDefaultSize() == parentFont.useFixedDefaultSize())
return;
// For now, lump all families but monospace together.
@@ -5601,17 +5778,16 @@ void CSSStyleSelector::checkForGenericFamilyChange(RenderStyle* style, RenderSty
// If the font uses a keyword size, then we refetch from the table rather than
// multiplying by our scale factor.
float size;
- if (childFont.keywordSize()) {
- size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(),
- childFont.genericFamily() == FontDescription::MonospaceFamily);
- } else {
+ if (childFont.keywordSize())
+ size = fontSizeForKeyword(CSSValueXxSmall + childFont.keywordSize() - 1, style->htmlHacks(), childFont.useFixedDefaultSize());
+ else {
Settings* settings = m_checker.m_document->settings();
float fixedScaleFactor = settings
? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize()
: 1;
- size = (parentFont.genericFamily() == FontDescription::MonospaceFamily) ?
- childFont.specifiedSize()/fixedScaleFactor :
- childFont.specifiedSize()*fixedScaleFactor;
+ size = parentFont.useFixedDefaultSize() ?
+ childFont.specifiedSize() / fixedScaleFactor :
+ childFont.specifiedSize() * fixedScaleFactor;
}
FontDescription newFontDescription(childFont);