Diff
Modified: trunk/LayoutTests/ChangeLog (187109 => 187110)
--- trunk/LayoutTests/ChangeLog 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/LayoutTests/ChangeLog 2015-07-21 18:43:46 UTC (rev 187110)
@@ -1,3 +1,14 @@
+2015-07-21 David Hyatt <hy...@apple.com>
+
+ Need a way to ignore text-zoom in a Web page.
+ https://bugs.webkit.org/show_bug.cgi?id=27092
+ rdar://problem/7037987
+
+ Reviewed by Simon Fraser.
+
+ * fast/text/text-zoom-reset-expected.html: Added.
+ * fast/text/text-zoom-reset.html: Added.
+
2015-07-20 Nan Wang <n_w...@apple.com>
AX: Selection change as a result of focusing an element may cause Safari to crash
Added: trunk/LayoutTests/fast/text/text-zoom-reset-expected.html (0 => 187110)
--- trunk/LayoutTests/fast/text/text-zoom-reset-expected.html (rev 0)
+++ trunk/LayoutTests/fast/text/text-zoom-reset-expected.html 2015-07-21 18:43:46 UTC (rev 187110)
@@ -0,0 +1,8 @@
+<!doctype html>
+<html style="font-size:18px">
+<body>
+<p style="-webkit-text-zoom:reset">This text should not zoom</p>
+<p style="-webkit-text-zoom:reset; font-size:24px">This text should not zoom</p>
+<p style="-webkit-text-zoom:reset; font-size:inherit">This text should not zoom</p>
+</body>
+</html>
Added: trunk/LayoutTests/fast/text/text-zoom-reset.html (0 => 187110)
--- trunk/LayoutTests/fast/text/text-zoom-reset.html (rev 0)
+++ trunk/LayoutTests/fast/text/text-zoom-reset.html 2015-07-21 18:43:46 UTC (rev 187110)
@@ -0,0 +1,14 @@
+<!doctype html>
+<html style="font-size:18px">
+<head>
+<script>
+if (window.internals)
+ window.internals.setTextZoomFactor(2)
+</script>
+</head>
+<body>
+<p style="-webkit-text-zoom:reset">This text should not zoom</p>
+<p style="-webkit-text-zoom:reset; font-size:24px">This text should not zoom</p>
+<p style="-webkit-text-zoom:reset; font-size:inherit">This text should not zoom</p>
+</body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (187109 => 187110)
--- trunk/Source/WebCore/ChangeLog 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/ChangeLog 2015-07-21 18:43:46 UTC (rev 187110)
@@ -1,3 +1,54 @@
+2015-07-21 David Hyatt <hy...@apple.com>
+
+ Need a way to ignore text-zoom in a Web page.
+ https://bugs.webkit.org/show_bug.cgi?id=27092
+ rdar://problem/7037987
+
+ Reviewed by Simon Fraser.
+
+ This patch adds a new property, -webkit-text-zoom, with values of normal and reset. The reset
+ keyword, just as with the zoom property, can be used to ignore any inherited zoom from the
+ document.
+
+ Added new test in fast/text.
+
+ * Modules/mediacontrols/mediaControlsApple.css:
+ (audio::-webkit-media-controls-panel):
+ (video::-webkit-media-controls-panel):
+ * css/CSSComputedStyleDeclaration.cpp:
+ (WebCore::ComputedStyleExtractor::propertyValue):
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::parseValue):
+ * css/CSSPrimitiveValueMappings.h:
+ (WebCore::CSSPrimitiveValue::operator ContentDistributionType):
+ (WebCore::CSSPrimitiveValue::operator TextZoom):
+ (WebCore::CSSPrimitiveValue::CSSPrimitiveValue):
+ * css/CSSPropertyNames.in:
+ * css/StyleBuilderConverter.h:
+ (WebCore::StyleBuilderConverter::csstoLengthConversionDataWithTextZoomFactor):
+ * css/StyleBuilderCustom.h:
+ (WebCore::StyleBuilderCustom::applyValueWebkitTextSizeAdjust):
+ (WebCore::StyleBuilderCustom::applyValueWebkitTextZoom):
+ (WebCore::StyleBuilderCustom::applyTextOrBoxShadowValue):
+ * css/StyleResolver.cpp:
+ (WebCore::StyleResolver::checkForZoomChange):
+ * rendering/style/RenderStyle.cpp:
+ (WebCore::RenderStyle::changeRequiresLayout):
+ * rendering/style/RenderStyle.h:
+ * rendering/style/RenderStyleConstants.h:
+ * rendering/style/StyleRareInheritedData.cpp:
+ (WebCore::StyleRareInheritedData::StyleRareInheritedData):
+ (WebCore::StyleRareInheritedData::operator==):
+ * rendering/style/StyleRareInheritedData.h:
+ * style/StyleFontSizeFunctions.cpp:
+ (WebCore::Style::computedFontSizeFromSpecifiedSize):
+ * testing/Internals.cpp:
+ (WebCore::Internals::setPageZoomFactor):
+ (WebCore::Internals::setTextZoomFactor):
+ (WebCore::Internals::setUseFixedLayout):
+ * testing/Internals.h:
+ * testing/Internals.idl:
+
2015-07-21 Per Arne Vollan <pe...@outlook.com>
WinLauncher does not start on WinXP.
Modified: trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css (187109 => 187110)
--- trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/Modules/mediacontrols/mediaControlsApple.css 2015-07-21 18:43:46 UTC (rev 187110)
@@ -87,6 +87,8 @@
direction: ltr;
transition: opacity 0.25s linear;
+
+ -webkit-text-zoom: reset
}
video::-webkit-media-controls-panel {
Modified: trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp (187109 => 187110)
--- trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp 2015-07-21 18:43:46 UTC (rev 187110)
@@ -395,6 +395,7 @@
#endif
CSSPropertyWebkitTextStrokeColor,
CSSPropertyWebkitTextStrokeWidth,
+ CSSPropertyWebkitTextZoom,
CSSPropertyWebkitTransformStyle,
CSSPropertyWebkitTransitionDelay,
CSSPropertyWebkitTransitionDuration,
@@ -3178,6 +3179,8 @@
return zoomAdjustedPixelValueForLength(style->svgStyle().x(), *style);
case CSSPropertyY:
return zoomAdjustedPixelValueForLength(style->svgStyle().y(), *style);
+ case CSSPropertyWebkitTextZoom:
+ return cssValuePool().createValue(style->textZoom());
/* Unimplemented CSS 3 properties (including CSS3 shorthand properties) */
case CSSPropertyAnimation:
Modified: trunk/Source/WebCore/css/CSSParser.cpp (187109 => 187110)
--- trunk/Source/WebCore/css/CSSParser.cpp 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2015-07-21 18:43:46 UTC (rev 187110)
@@ -2358,12 +2358,19 @@
// auto | alphabetic | under
return parseTextUnderlinePosition(important);
- case CSSPropertyZoom: // normal | reset | document | <number> | <percentage> | inherit
+ case CSSPropertyZoom:
+ // normal | reset | document | <number> | <percentage> | inherit
if (id == CSSValueNormal || id == CSSValueReset || id == CSSValueDocument)
validPrimitive = true;
else
validPrimitive = (!id && validateUnit(valueWithCalculation, FNumber | FPercent | FNonNeg, CSSStrictMode));
break;
+
+ case CSSPropertyWebkitTextZoom:
+ // normal | reset
+ if (id == CSSValueNormal || id == CSSValueReset)
+ validPrimitive = true;
+ break;
case CSSPropertySrc: // Only used within @font-face and @-webkit-filter, so cannot use inherit | initial or be !important. This is a list of urls or local references.
return parseFontFaceSrc();
Modified: trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h (187109 => 187110)
--- trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h 2015-07-21 18:43:46 UTC (rev 187110)
@@ -5254,6 +5254,40 @@
return ContentDistributionStretch;
}
+template<> inline CSSPrimitiveValue::operator TextZoom() const
+{
+ ASSERT(isValueID());
+
+ switch (m_value.valueID) {
+ case CSSValueNormal:
+ return TextZoomNormal;
+ case CSSValueReset:
+ return TextZoomReset;
+ default:
+ break;
+ }
+
+ ASSERT_NOT_REACHED();
+ return TextZoomNormal;
+}
+
+template<> inline CSSPrimitiveValue::CSSPrimitiveValue(TextZoom textZoom)
+ : CSSValue(PrimitiveClass)
+{
+ m_primitiveUnitType = CSS_VALUE_ID;
+ switch (textZoom) {
+ case TextZoomNormal:
+ m_value.valueID = CSSValueNormal;
+ return;
+ case TextZoomReset:
+ m_value.valueID = CSSValueReset;
+ return;
+ }
+
+ ASSERT_NOT_REACHED();
+ m_value.valueID = CSSValueNormal;
+}
+
#if ENABLE(CSS_SCROLL_SNAP)
template<> inline CSSPrimitiveValue::CSSPrimitiveValue(ScrollSnapType e)
: CSSValue(PrimitiveClass)
Modified: trunk/Source/WebCore/css/CSSPropertyNames.in (187109 => 187110)
--- trunk/Source/WebCore/css/CSSPropertyNames.in 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/css/CSSPropertyNames.in 2015-07-21 18:43:46 UTC (rev 187110)
@@ -117,6 +117,7 @@
#endif
-webkit-writing-mode [Inherited, Custom=Value]
-epub-writing-mode = -webkit-writing-mode
+-webkit-text-zoom [Inherited, Custom=Value]
zoom [Custom=All]
font-synthesis [Inherited, FontProperty, Converter=FontSynthesis]
Modified: trunk/Source/WebCore/css/StyleBuilderConverter.h (187109 => 187110)
--- trunk/Source/WebCore/css/StyleBuilderConverter.h 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/css/StyleBuilderConverter.h 2015-07-21 18:43:46 UTC (rev 187110)
@@ -930,9 +930,10 @@
inline CSSToLengthConversionData StyleBuilderConverter::csstoLengthConversionDataWithTextZoomFactor(StyleResolver& styleResolver)
{
- if (auto* frame = styleResolver.document().frame())
- return styleResolver.state().cssToLengthConversionData().copyWithAdjustedZoom(styleResolver.style()->effectiveZoom() * frame->textZoomFactor());
-
+ if (auto* frame = styleResolver.document().frame()) {
+ float textZoomFactor = styleResolver.style()->textZoom() != TextZoomReset ? frame->textZoomFactor() : 1.0f;
+ return styleResolver.state().cssToLengthConversionData().copyWithAdjustedZoom(styleResolver.style()->effectiveZoom() * textZoomFactor);
+ }
return styleResolver.state().cssToLengthConversionData();
}
Modified: trunk/Source/WebCore/css/StyleBuilderCustom.h (187109 => 187110)
--- trunk/Source/WebCore/css/StyleBuilderCustom.h 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/css/StyleBuilderCustom.h 2015-07-21 18:43:46 UTC (rev 187110)
@@ -125,6 +125,7 @@
#if ENABLE(IOS_TEXT_AUTOSIZING)
static void applyValueWebkitTextSizeAdjust(StyleResolver&, CSSValue&);
#endif
+ static void applyValueWebkitTextZoom(StyleResolver&, CSSValue&);
static void applyValueWebkitWritingMode(StyleResolver&, CSSValue&);
static void applyValueAlt(StyleResolver&, CSSValue&);
#if ENABLE(CSS_SCROLL_SNAP)
@@ -731,6 +732,16 @@
}
#endif
+inline void StyleBuilderCustom::applyValueWebkitTextZoom(StyleResolver& styleResolver, CSSValue& value)
+{
+ auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
+ if (primitiveValue.getValueID() == CSSValueNormal)
+ styleResolver.style()->setTextZoom(TextZoomNormal);
+ else if (primitiveValue.getValueID() == CSSValueReset)
+ styleResolver.style()->setTextZoom(TextZoomReset);
+ styleResolver.state().setFontDirty(true);
+}
+
template <CSSPropertyID id>
inline void StyleBuilderCustom::applyTextOrBoxShadowValue(StyleResolver& styleResolver, CSSValue& value)
{
Modified: trunk/Source/WebCore/css/StyleResolver.cpp (187109 => 187110)
--- trunk/Source/WebCore/css/StyleResolver.cpp 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/css/StyleResolver.cpp 2015-07-21 18:43:46 UTC (rev 187110)
@@ -1991,7 +1991,7 @@
if (!parentStyle)
return;
- if (style->effectiveZoom() == parentStyle->effectiveZoom())
+ if (style->effectiveZoom() == parentStyle->effectiveZoom() && style->textZoom() == parentStyle->textZoom())
return;
const FontDescription& childFont = style->fontDescription();
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.cpp (187109 => 187110)
--- trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.cpp 2015-07-21 18:43:46 UTC (rev 187110)
@@ -563,6 +563,7 @@
|| rareInheritedData->m_textIndentLine != other.rareInheritedData->m_textIndentLine
#endif
|| rareInheritedData->m_effectiveZoom != other.rareInheritedData->m_effectiveZoom
+ || rareInheritedData->m_textZoom != other.rareInheritedData->m_textZoom
#if ENABLE(IOS_TEXT_AUTOSIZING)
|| rareInheritedData->textSizeAdjust != other.rareInheritedData->textSizeAdjust
#endif
Modified: trunk/Source/WebCore/rendering/style/RenderStyle.h (187109 => 187110)
--- trunk/Source/WebCore/rendering/style/RenderStyle.h 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/rendering/style/RenderStyle.h 2015-07-21 18:43:46 UTC (rev 187110)
@@ -731,6 +731,8 @@
float zoom() const { return visual->m_zoom; }
float effectiveZoom() const { return rareInheritedData->m_effectiveZoom; }
+
+ TextZoom textZoom() const { return static_cast<TextZoom>(rareInheritedData->m_textZoom); }
TextDirection direction() const { return static_cast<TextDirection>(inherited_flags._direction); }
bool isLeftToRightDirection() const { return direction() == LTR; }
@@ -1370,7 +1372,8 @@
bool setZoom(float);
void setZoomWithoutReturnValue(float f) { setZoom(f); }
bool setEffectiveZoom(float);
-
+ void setTextZoom(TextZoom v) { SET_VAR(rareInheritedData, m_textZoom, v); }
+
#if ENABLE(CSS_IMAGE_ORIENTATION)
void setImageOrientation(ImageOrientationEnum v) { SET_VAR(rareInheritedData, m_imageOrientation, static_cast<int>(v)); }
#endif
@@ -1920,6 +1923,7 @@
static TextDecorationSkip initialTextDecorationSkip() { return TextDecorationSkipAuto; }
static TextUnderlinePosition initialTextUnderlinePosition() { return TextUnderlinePositionAuto; }
static float initialZoom() { return 1.0f; }
+ static TextZoom initialTextZoom() { return TextZoomNormal; }
static int initialOutlineOffset() { return 0; }
static float initialOpacity() { return 1.0f; }
static EBoxAlignment initialBoxAlign() { return BSTRETCH; }
Modified: trunk/Source/WebCore/rendering/style/RenderStyleConstants.h (187109 => 187110)
--- trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/rendering/style/RenderStyleConstants.h 2015-07-21 18:43:46 UTC (rev 187110)
@@ -465,6 +465,10 @@
TextUnderlinePositionAuto = 0x1, TextUnderlinePositionAlphabetic = 0x2, TextUnderlinePositionUnder = 0x4
};
+enum TextZoom {
+ TextZoomNormal, TextZoomReset
+};
+
enum EPageBreak {
PBAUTO, PBALWAYS, PBAVOID
};
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp (187109 => 187110)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp 2015-07-21 18:43:46 UTC (rev 187110)
@@ -113,6 +113,7 @@
, m_textDecorationSkip(RenderStyle::initialTextDecorationSkip())
, m_textUnderlinePosition(RenderStyle::initialTextUnderlinePosition())
, m_rubyPosition(RenderStyle::initialRubyPosition())
+ , m_textZoom(RenderStyle::initialTextZoom())
#if PLATFORM(IOS)
, touchCalloutEnabled(RenderStyle::initialTouchCalloutEnabled())
#endif
@@ -194,6 +195,7 @@
, m_textDecorationSkip(o.m_textDecorationSkip)
, m_textUnderlinePosition(o.m_textUnderlinePosition)
, m_rubyPosition(o.m_rubyPosition)
+ , m_textZoom(o.m_textZoom)
#if PLATFORM(IOS)
, touchCalloutEnabled(o.touchCalloutEnabled)
#endif
@@ -321,6 +323,7 @@
&& m_textDecorationSkip == o.m_textDecorationSkip
&& m_textUnderlinePosition == o.m_textUnderlinePosition
&& m_rubyPosition == o.m_rubyPosition
+ && m_textZoom == o.m_textZoom
&& m_lineSnap == o.m_lineSnap
&& m_lineAlign == o.m_lineAlign
#if ENABLE(CSS_TRAILING_WORD)
Modified: trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h (187109 => 187110)
--- trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h 2015-07-21 18:43:46 UTC (rev 187110)
@@ -124,6 +124,7 @@
unsigned m_textDecorationSkip : 5; // TextDecorationSkip
unsigned m_textUnderlinePosition : 3; // TextUnderlinePosition
unsigned m_rubyPosition : 2; // RubyPosition
+ unsigned m_textZoom: 1; // TextZoom
#if PLATFORM(IOS)
unsigned touchCalloutEnabled : 1;
Modified: trunk/Source/WebCore/style/StyleFontSizeFunctions.cpp (187109 => 187110)
--- trunk/Source/WebCore/style/StyleFontSizeFunctions.cpp 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/style/StyleFontSizeFunctions.cpp 2015-07-21 18:43:46 UTC (rev 187110)
@@ -95,7 +95,8 @@
float zoomFactor = 1.0f;
if (!useSVGZoomRules) {
zoomFactor = style->effectiveZoom();
- if (Frame* frame = document.frame())
+ Frame* frame = document.frame();
+ if (frame && style->textZoom() != TextZoomReset)
zoomFactor *= frame->textZoomFactor();
}
return computedFontSizeFromSpecifiedSize(specifiedSize, isAbsoluteSize, zoomFactor, useSVGZoomRules ? DoNotApplyMinimumFontSize : UseSmartMinimumForFontFize, document.settings());
Modified: trunk/Source/WebCore/testing/Internals.cpp (187109 => 187110)
--- trunk/Source/WebCore/testing/Internals.cpp 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/testing/Internals.cpp 2015-07-21 18:43:46 UTC (rev 187110)
@@ -2012,6 +2012,17 @@
frame->setPageZoomFactor(zoomFactor);
}
+void Internals::setTextZoomFactor(float zoomFactor, ExceptionCode& ec)
+{
+ Document* document = contextDocument();
+ if (!document || !document->frame()) {
+ ec = INVALID_ACCESS_ERR;
+ return;
+ }
+ Frame* frame = document->frame();
+ frame->setTextZoomFactor(zoomFactor);
+}
+
void Internals::setUseFixedLayout(bool useFixedLayout, ExceptionCode& ec)
{
Document* document = contextDocument();
Modified: trunk/Source/WebCore/testing/Internals.h (187109 => 187110)
--- trunk/Source/WebCore/testing/Internals.h 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/testing/Internals.h 2015-07-21 18:43:46 UTC (rev 187110)
@@ -279,6 +279,7 @@
void setPageScaleFactor(float scaleFactor, int x, int y, ExceptionCode&);
void setPageZoomFactor(float zoomFactor, ExceptionCode&);
+ void setTextZoomFactor(float zoomFactor, ExceptionCode&);
void setUseFixedLayout(bool useFixedLayout, ExceptionCode&);
void setFixedLayoutSize(int width, int height, ExceptionCode&);
Modified: trunk/Source/WebCore/testing/Internals.idl (187109 => 187110)
--- trunk/Source/WebCore/testing/Internals.idl 2015-07-21 18:40:07 UTC (rev 187109)
+++ trunk/Source/WebCore/testing/Internals.idl 2015-07-21 18:43:46 UTC (rev 187110)
@@ -253,6 +253,7 @@
[RaisesException] void setPageScaleFactor(unrestricted float scaleFactor, long x, long y);
[RaisesException] void setPageZoomFactor(unrestricted float zoomFactor);
+ [RaisesException] void setTextZoomFactor(unrestricted float zoomFactor);
[RaisesException] void setUseFixedLayout(boolean useFixedLayout);
[RaisesException] void setFixedLayoutSize(long width, long height);