Modified: trunk/Source/WebCore/css/StyleResolver.cpp (219538 => 219539)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2017-07-15 21:47:16 UTC (rev 219538)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2017-07-15 22:03:23 UTC (rev 219539)
@@ -425,7 +425,7 @@
// decl, there's nothing to override. So just add the first properties.
CascadedProperties cascade(direction, writingMode);
cascade.addNormalMatches(result, 0, result.matchedProperties().size() - 1);
-
+
// Resolve custom properties first.
applyCascadedProperties(cascade, CSSPropertyCustom, CSSPropertyCustom, &result);
@@ -1048,7 +1048,7 @@
if ((element->hasTagName(SVGNames::foreignObjectTag) || element->hasTagName(SVGNames::textTag)) && style.isDisplayInlineType())
style.setDisplay(BLOCK);
}
-
+
// If the inherited value of justify-items includes the 'legacy' keyword,
// 'auto' computes to the the inherited value. Otherwise, 'auto' computes to
// 'normal'.
@@ -1057,7 +1057,7 @@
style.setJustifyItems(parentBoxStyle->justifyItems());
}
}
-
+
bool StyleResolver::checkRegionStyle(const Element* regionElement)
{
unsigned rulesSize = m_ruleSets.authorStyle().regionSelectorsAndRuleSets().size();
@@ -1133,7 +1133,7 @@
if (rulesToInclude & UAAndUserCSSRules) {
// First we match rules from the user agent sheet.
collector.matchUARules();
-
+
// Now we check user sheet rules.
if (m_matchAuthorAndUserStyles)
collector.matchUserRules(rulesToInclude & EmptyCSSRules);
@@ -1375,13 +1375,13 @@
applyCascadedProperties(cascade, CSSPropertyWebkitRubyPosition, CSSPropertyWebkitRubyPosition, &matchResult);
adjustStyleForInterCharacterRuby();
-
+
// Resolve custom variables first.
applyCascadedProperties(cascade, CSSPropertyCustom, CSSPropertyCustom, &matchResult);
// Start by applying properties that other properties may depend on.
applyCascadedProperties(cascade, firstCSSProperty, lastHighPriorityProperty, &matchResult);
-
+
updateFont();
applyCascadedProperties(cascade, firstLowPriorityProperty, lastCSSProperty, &matchResult);
@@ -1393,12 +1393,12 @@
cascade.addImportantMatches(matchResult, matchResult.ranges.firstAuthorRule, matchResult.ranges.lastAuthorRule, applyInheritedOnly);
cascade.addImportantMatches(matchResult, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, applyInheritedOnly);
cascade.addImportantMatches(matchResult, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, applyInheritedOnly);
-
+
// Resolve custom properties first.
applyCascadedProperties(cascade, CSSPropertyCustom, CSSPropertyCustom, &matchResult);
applyCascadedProperties(cascade, CSSPropertyWebkitRubyPosition, CSSPropertyWebkitRubyPosition, &matchResult);
-
+
// Adjust the font size to be smaller if ruby-position is inter-character.
adjustStyleForInterCharacterRuby();
@@ -1425,7 +1425,7 @@
cascade.applyDeferredProperties(*this, &matchResult);
ASSERT(!state.fontDirty());
-
+
if (cacheItem || !cacheHash)
return;
if (!isCacheableInMatchedPropertiesCache(*state.element(), state.style(), state.parentStyle()))
@@ -1556,7 +1556,7 @@
StyleResolver::CascadedProperties* StyleResolver::cascadedPropertiesForRollback(const MatchResult& matchResult)
{
ASSERT(cascadeLevel() != UserAgentLevel);
-
+
TextDirection direction;
WritingMode writingMode;
extractDirectionAndWritingMode(*state().style(), matchResult, direction, writingMode);
@@ -1565,34 +1565,34 @@
CascadedProperties* authorRollback = state().authorRollback();
if (authorRollback)
return authorRollback;
-
+
auto newAuthorRollback(std::make_unique<CascadedProperties>(direction, writingMode));
-
+
// This special rollback cascade contains UA rules and user rules but no author rules.
newAuthorRollback->addNormalMatches(matchResult, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, false);
newAuthorRollback->addNormalMatches(matchResult, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, false);
newAuthorRollback->addImportantMatches(matchResult, matchResult.ranges.firstUserRule, matchResult.ranges.lastUserRule, false);
newAuthorRollback->addImportantMatches(matchResult, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, false);
-
+
state().setAuthorRollback(newAuthorRollback);
return state().authorRollback();
}
-
+
if (cascadeLevel() == UserLevel) {
CascadedProperties* userRollback = state().userRollback();
if (userRollback)
return userRollback;
-
+
auto newUserRollback(std::make_unique<CascadedProperties>(direction, writingMode));
-
+
// This special rollback cascade contains only UA rules.
newUserRollback->addNormalMatches(matchResult, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, false);
newUserRollback->addImportantMatches(matchResult, matchResult.ranges.firstUARule, matchResult.ranges.lastUARule, false);
-
+
state().setUserRollback(newUserRollback);
return state().userRollback();
}
-
+
return nullptr;
}
@@ -1601,7 +1601,7 @@
ASSERT_WITH_MESSAGE(!isShorthandCSSProperty(id), "Shorthand property id = %d wasn't expanded at parsing time", id);
State& state = m_state;
-
+
RefPtr<CSSValue> valueToApply = value;
if (value->hasVariableReferences()) {
valueToApply = resolvedVariableValue(id, *value);
@@ -1618,11 +1618,11 @@
ASSERT(newId != id);
return applyProperty(newId, valueToApply.get(), linkMatchMask, matchResult);
}
-
+
CSSValue* valueToCheckForInheritInitial = valueToApply.get();
CSSCustomPropertyValue* customPropertyValue = nullptr;
CSSValueID customPropertyValueID = CSSValueInvalid;
-
+
if (id == CSSPropertyCustom) {
customPropertyValue = &downcast<CSSCustomPropertyValue>(*valueToApply);
customPropertyValueID = customPropertyValue->valueID();
@@ -1630,7 +1630,7 @@
bool isInherit = state.parentStyle() ? valueToCheckForInheritInitial->isInheritedValue() || customPropertyValueID == CSSValueInherit : false;
bool isInitial = valueToCheckForInheritInitial->isInitialValue() || customPropertyValueID == CSSValueInitial || (!state.parentStyle() && (valueToCheckForInheritInitial->isInheritedValue() || customPropertyValueID == CSSValueInherit));
-
+
bool isUnset = valueToCheckForInheritInitial->isUnsetValue() || customPropertyValueID == CSSValueUnset;
bool isRevert = valueToCheckForInheritInitial->isRevertValue() || customPropertyValueID == CSSValueRevert;
@@ -1659,11 +1659,11 @@
applyProperty(property.id, property.cssValue[linkMatchMask], linkMatchMask, matchResult);
return;
}
-
+
isUnset = true;
}
}
-
+
if (isUnset) {
if (CSSProperty::isInheritedProperty(id))
isInherit = true;
@@ -1680,7 +1680,7 @@
if (isInherit && !CSSProperty::isInheritedProperty(id))
state.style()->setHasExplicitlyInheritedProperties();
-
+
if (customPropertyValue) {
auto& name = customPropertyValue->name();
auto* value = isInitial ? nullptr : isInherit ? state.parentStyle()->customProperties().get(name) : customPropertyValue;
@@ -1736,7 +1736,7 @@
{
if (!parentStyle)
return;
-
+
if (style->effectiveZoom() == parentStyle->effectiveZoom() && style->textZoom() == parentStyle->textZoom())
return;
@@ -1899,13 +1899,13 @@
{
State& state = m_state;
ASSERT(outOperations.isEmpty());
-
+
if (is<CSSPrimitiveValue>(inValue)) {
auto& primitiveValue = downcast<CSSPrimitiveValue>(inValue);
if (primitiveValue.valueID() == CSSValueNone)
return true;
}
-
+
if (!is<CSSValueList>(inValue))
return false;
@@ -2099,7 +2099,7 @@
}
return;
}
-
+
if (!m_propertyIsPresent[id])
memset(property.cssValue, 0, sizeof(property.cssValue));
m_propertyIsPresent.set(id);
@@ -2269,7 +2269,7 @@
ASSERT(!shouldApplyPropertyInParseOrder(propertyID));
property.apply(*this, matchResult);
}
-
+
if (firstProperty == CSSPropertyCustom)
m_state.style()->checkVariablesInCustomProperties();
}
Modified: trunk/Source/WebCore/style/StyleFontSizeFunctions.cpp (219538 => 219539)
--- trunk/Source/WebCore/style/StyleFontSizeFunctions.cpp 2017-07-15 21:47:16 UTC (rev 219538)
+++ trunk/Source/WebCore/style/StyleFontSizeFunctions.cpp 2017-07-15 22:03:23 UTC (rev 219539)
@@ -39,10 +39,10 @@
namespace Style {
-enum MinimumFontSizeRule {
- DoNotApplyMinimumFontSize,
- DoNotUseSmartMinimumForFontSize,
- UseSmartMinimumForFontFize
+enum class MinimumFontSizeRule {
+ None,
+ Absolute,
+ AbsoluteAndRelative
};
static float computedFontSizeFromSpecifiedSize(float specifiedSize, bool isAbsoluteSize, float zoomFactor, MinimumFontSizeRule minimumSizeRule, const Settings& settings)
@@ -64,7 +64,7 @@
// However we always allow the page to set an explicit pixel size that is smaller,
// since sites will mis-render otherwise (e.g., http://www.gamespot.com with a 9px minimum).
- if (minimumSizeRule == DoNotApplyMinimumFontSize)
+ if (minimumSizeRule == MinimumFontSizeRule::None)
return specifiedSize;
int minSize = settings.minimumFontSize();
@@ -72,18 +72,17 @@
float zoomedSize = specifiedSize * zoomFactor;
// Apply the hard minimum first. We only apply the hard minimum if after zooming we're still too small.
- if (zoomedSize < minSize)
- zoomedSize = minSize;
+ zoomedSize = std::max(zoomedSize, static_cast<float>(minSize));
- // Now apply the "smart minimum." This minimum is also only applied if we're still too small
+ // Now apply the smart minimum. This minimum is also only applied if we're still too small
// after zooming. The font size must either be relative to the user default or the original size
// must have been acceptable. In other words, we only apply the smart minimum whenever we're positive
// doing so won't disrupt the layout.
- if (minimumSizeRule == UseSmartMinimumForFontFize && zoomedSize < minLogicalSize && (specifiedSize >= minLogicalSize || !isAbsoluteSize))
- zoomedSize = minLogicalSize;
+ if (minimumSizeRule == MinimumFontSizeRule::AbsoluteAndRelative && (specifiedSize >= minLogicalSize || !isAbsoluteSize))
+ zoomedSize = std::max(zoomedSize, static_cast<float>(minLogicalSize));
// Also clamp to a reasonable maximum to prevent insane font sizes from causing crashes on various
- // platforms (I'm looking at you, Windows.)
+ // platforms. (I'm looking at you, Windows.)
return std::min(maximumAllowedFontSize, zoomedSize);
}
@@ -96,12 +95,12 @@
if (frame && style->textZoom() != TextZoomReset)
zoomFactor *= frame->textZoomFactor();
}
- return computedFontSizeFromSpecifiedSize(specifiedSize, isAbsoluteSize, zoomFactor, useSVGZoomRules ? DoNotApplyMinimumFontSize : UseSmartMinimumForFontFize, document.settings());
+ return computedFontSizeFromSpecifiedSize(specifiedSize, isAbsoluteSize, zoomFactor, useSVGZoomRules ? MinimumFontSizeRule::None : MinimumFontSizeRule::AbsoluteAndRelative, document.settings());
}
float computedFontSizeFromSpecifiedSizeForSVGInlineText(float specifiedSize, bool isAbsoluteSize, float zoomFactor, const Document& document)
{
- return computedFontSizeFromSpecifiedSize(specifiedSize, isAbsoluteSize, zoomFactor, DoNotUseSmartMinimumForFontSize, document.settings());
+ return computedFontSizeFromSpecifiedSize(specifiedSize, isAbsoluteSize, zoomFactor, MinimumFontSizeRule::Absolute, document.settings());
}
const int fontSizeTableMax = 16;