Skip to content

Commit

Permalink
[iOS] Upstream WebCore/css changes
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=126237

Reviewed by Simon Fraser.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue): Added iOS-specific code and FIXME comment.
* css/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext): Ditto.
(WebCore::CSSParser::parseValue): Ditto.
* css/CSSPropertyNames.in: Added property -webkit-composition-fill-color. Also added FIXME comment.
* css/CSSValueKeywords.in: Added iOS-specific -apple-system-* values.
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): Added iOS-specific code and FIXME comments.
* css/MediaFeatureNames.h: Added media feature -webkit-video-playable-inline.
* css/MediaQueryEvaluator.cpp:
(WebCore::isRunningOnIPhoneOrIPod): Added. Also added FIXME comment.
(WebCore::video_playable_inlineMediaFeatureEval): Added.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::canShareStyleWithElement): Substitute toHTMLMediaElement() for toMediaElement().
(WebCore::StyleResolver::applyProperty): Added iOS-specific code and FIXME comment.
* css/html.css: Added iOS-specific CSS styles.
(input, textarea, keygen, select, button, isindex):
(isindex):
(input[type="date"]):
(input[type="datetime"]):
(input[type="datetime-local"]):
(input[type="month"]):
(input[type="time"]):
(textarea):
(input:-webkit-autofill):
(input[type="radio"], input[type="checkbox"]):
(input[type="button"], input[type="submit"], input[type="reset"], input[type="file"]::-webkit-file-upload-button, button):
(input[type="range"]::-webkit-slider-thumb, input[type="range"]::-webkit-media-slider-thumb):
(input[type="range"]::-webkit-slider-thumb:active):
(input:disabled, textarea:disabled):
(input[readonly], textarea[readonly]):
(textarea::-webkit-input-placeholder):
(input[type="checkbox"]):
(input[type="radio"]):
(input[type="checkbox"]:checked, input[type="radio"]:checked):
(input[type="checkbox"]:checked:disabled, input[type="radio"]:checked:disabled):
(select:focus):
(select):
* css/mathml.css: Added iOS-specific CSS styles.
(math, mfenced > *):
(mo, mfenced):
* css/mediaControlsiOS.css: Added.
* css/svg.css: Added iOS-specific CSS styles.
(text, tspan, tref):

Canonical link: https://commits.webkit.org/144356@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@161286 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
dydz committed Jan 3, 2014
1 parent cbce021 commit 4c77853
Show file tree
Hide file tree
Showing 13 changed files with 345 additions and 8 deletions.
53 changes: 53 additions & 0 deletions Source/WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,56 @@
2014-01-03 Daniel Bates <dabates@apple.com>

[iOS] Upstream WebCore/css changes
https://bugs.webkit.org/show_bug.cgi?id=126237

Reviewed by Simon Fraser.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::ComputedStyleExtractor::propertyValue): Added iOS-specific code and FIXME comment.
* css/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext): Ditto.
(WebCore::CSSParser::parseValue): Ditto.
* css/CSSPropertyNames.in: Added property -webkit-composition-fill-color. Also added FIXME comment.
* css/CSSValueKeywords.in: Added iOS-specific -apple-system-* values.
* css/DeprecatedStyleBuilder.cpp:
(WebCore::DeprecatedStyleBuilder::DeprecatedStyleBuilder): Added iOS-specific code and FIXME comments.
* css/MediaFeatureNames.h: Added media feature -webkit-video-playable-inline.
* css/MediaQueryEvaluator.cpp:
(WebCore::isRunningOnIPhoneOrIPod): Added. Also added FIXME comment.
(WebCore::video_playable_inlineMediaFeatureEval): Added.
* css/StyleResolver.cpp:
(WebCore::StyleResolver::canShareStyleWithElement): Substitute toHTMLMediaElement() for toMediaElement().
(WebCore::StyleResolver::applyProperty): Added iOS-specific code and FIXME comment.
* css/html.css: Added iOS-specific CSS styles.
(input, textarea, keygen, select, button, isindex):
(isindex):
(input[type="date"]):
(input[type="datetime"]):
(input[type="datetime-local"]):
(input[type="month"]):
(input[type="time"]):
(textarea):
(input:-webkit-autofill):
(input[type="radio"], input[type="checkbox"]):
(input[type="button"], input[type="submit"], input[type="reset"], input[type="file"]::-webkit-file-upload-button, button):
(input[type="range"]::-webkit-slider-thumb, input[type="range"]::-webkit-media-slider-thumb):
(input[type="range"]::-webkit-slider-thumb:active):
(input:disabled, textarea:disabled):
(input[readonly], textarea[readonly]):
(textarea::-webkit-input-placeholder):
(input[type="checkbox"]):
(input[type="radio"]):
(input[type="checkbox"]:checked, input[type="radio"]:checked):
(input[type="checkbox"]:checked:disabled, input[type="radio"]:checked:disabled):
(select:focus):
(select):
* css/mathml.css: Added iOS-specific CSS styles.
(math, mfenced > *):
(mo, mfenced):
* css/mediaControlsiOS.css: Added.
* css/svg.css: Added iOS-specific CSS styles.
(text, tspan, tref):

2014-01-03 Brent Fulgham <bfulgham@apple.com>

[WebGL] glScissor test is not accounted for when generating internal rendering textures.
Expand Down
10 changes: 10 additions & 0 deletions Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,10 @@ static const CSSPropertyID computedProperties[] = {
CSSPropertyWebkitRtlOrdering,
#if PLATFORM(IOS)
CSSPropertyWebkitTouchCallout,

// FIXME: This property shouldn't be iOS-specific. Once we fix up its usage in InlineTextBox::paintCompositionBackground()
// we should move it outside the PLATFORM(IOS)-guard. See <https://bugs.webkit.org/show_bug.cgi?id=126296>.
CSSPropertyWebkitCompositionFillColor,
#endif
#if ENABLE(CSS_SHAPES)
CSSPropertyWebkitShapeInside,
Expand Down Expand Up @@ -2739,6 +2743,12 @@ PassRefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propert
}
case CSSPropertyWebkitRtlOrdering:
return cssValuePool().createIdentifierValue(style->rtlOrdering() ? CSSValueVisual : CSSValueLogical);
#if PLATFORM(IOS)
// FIXME: This property shouldn't be iOS-specific. Once we fix up its usage in InlineTextBox::paintCompositionBackground()
// we should remove the PLATFORM(IOS)-guard. See <https://bugs.webkit.org/show_bug.cgi?id=126296>.
case CSSPropertyWebkitCompositionFillColor:
return currentColorOrValidColor(style.get(), style->compositionFillColor());
#endif
#if ENABLE(TOUCH_EVENTS)
case CSSPropertyWebkitTapHighlightColor:
return currentColorOrValidColor(style.get(), style->tapHighlightColor());
Expand Down
28 changes: 27 additions & 1 deletion Source/WebCore/css/CSSParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -264,6 +264,12 @@ CSSParserContext::CSSParserContext(CSSParserMode mode, const URL& baseURL)
, enforcesCSSMIMETypeInNoQuirksMode(true)
, useLegacyBackgroundSizeShorthandBehavior(false)
{
#if PLATFORM(IOS)
// FIXME: Force the site specific quirk below to work on iOS. Investigating other site specific quirks
// to see if we can enable the preference all together is to be handled by:
// <rdar://problem/8493309> Investigate Enabling Site Specific Quirks in MobileSafari and UIWebView
needsSiteSpecificQuirks = true;
#endif
}

CSSParserContext::CSSParserContext(Document& document, const URL& baseURL, const String& charset)
Expand All @@ -280,6 +286,12 @@ CSSParserContext::CSSParserContext(Document& document, const URL& baseURL, const
, enforcesCSSMIMETypeInNoQuirksMode(!document.settings() || document.settings()->enforceCSSMIMETypeInNoQuirksMode())
, useLegacyBackgroundSizeShorthandBehavior(document.settings() ? document.settings()->useLegacyBackgroundSizeShorthandBehavior() : false)
{
#if PLATFORM(IOS)
// FIXME: Force the site specific quirk below to work on iOS. Investigating other site specific quirks
// to see if we can enable the preference all together is to be handled by:
// <rdar://problem/8493309> Investigate Enabling Site Specific Quirks in MobileSafari and UIWebView
needsSiteSpecificQuirks = true;
#endif
}

bool operator==(const CSSParserContext& a, const CSSParserContext& b)
Expand Down Expand Up @@ -2760,6 +2772,19 @@ bool CSSParser::parseValue(CSSPropertyID propId, bool important)
#endif

#if PLATFORM(IOS)
// FIXME: CSSPropertyWebkitCompositionFillColor shouldn't be iOS-specific. Once we fix up its usage in
// InlineTextBox::paintCompositionBackground() we should move it outside the PLATFORM(IOS)-guard.
// See <https://bugs.webkit.org/show_bug.cgi?id=126296>.
case CSSPropertyWebkitCompositionFillColor:
if ((id >= CSSValueAqua && id <= CSSValueWindowtext) || id == CSSValueMenu
|| (id >= CSSValueWebkitFocusRingColor && id < CSSValueWebkitText && inQuirksMode())) {
validPrimitive = true;
} else {
parsedValue = parseColor();
if (parsedValue)
m_valueList->next();
}
break;
case CSSPropertyWebkitTouchCallout:
if (id == CSSValueDefault || id == CSSValueNone)
validPrimitive = true;
Expand Down Expand Up @@ -12729,7 +12754,8 @@ static CSSValueID cssValueKeywordID(const CharacterType* valueKeyword, unsigned
if (buffer[0] == '-') {
// If the prefix is -apple- or -khtml-, change it to -webkit-.
// This makes the string one character longer.
if (hasPrefix(buffer, length, "-apple-") || hasPrefix(buffer, length, "-khtml-")) {
// On iOS we don't want to change values starting with -apple-system to -webkit-system.
if ((hasPrefix(buffer, length, "-apple-") && !hasPrefix(buffer, length, "-apple-system")) || hasPrefix(buffer, length, "-khtml-")) {
memmove(buffer + 7, buffer + 6, length + 1 - 6);
memcpy(buffer, "-webkit", 7);
++length;
Expand Down
4 changes: 4 additions & 0 deletions Source/WebCore/css/CSSPropertyNames.in
Original file line number Diff line number Diff line change
Expand Up @@ -465,4 +465,8 @@ user-zoom
#endif
#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS
-webkit-touch-callout [Inherited]

// FIXME: This property shouldn't be iOS-specific. Once we fix up its usage in InlineTextBox::paintCompositionBackground()
// we should move it outside the WTF_PLATFORM_IOS-guard.
-webkit-composition-fill-color [Inherited]
#endif
17 changes: 17 additions & 0 deletions Source/WebCore/css/CSSValueKeywords.in
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,23 @@ small-caption
-webkit-mini-control
-webkit-small-control
-webkit-control

#if defined(WTF_PLATFORM_IOS) && WTF_PLATFORM_IOS
-apple-system-headline
-apple-system-body
-apple-system-subheadline
-apple-system-footnote
-apple-system-caption1
-apple-system-caption2
-apple-system-short-headline
-apple-system-short-body
-apple-system-short-subheadline
-apple-system-short-footnote
-apple-system-short-caption1
-apple-system-tall-body
#endif

// This has to go after the -apple-system versions.
status-bar

//
Expand Down
16 changes: 16 additions & 0 deletions Source/WebCore/css/DeprecatedStyleBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2312,7 +2312,15 @@ DeprecatedStyleBuilder::DeprecatedStyleBuilder()
setPropertyHandler(CSSPropertyImageResolution, ApplyPropertyImageResolution::createHandler());
#endif
setPropertyHandler(CSSPropertyLeft, ApplyPropertyLength<&RenderStyle::left, &RenderStyle::setLeft, &RenderStyle::initialOffset, AutoEnabled>::createHandler());

// FIXME: We should reconcile the difference in datatype between iOS and OpenSource. On iOS we want letter spacing to
// be float for sub-pixel kerning. See <https://bugs.webkit.org/show_bug.cgi?id=20606>.
#if !PLATFORM(IOS)
setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<int, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
#else
setPropertyHandler(CSSPropertyLetterSpacing, ApplyPropertyComputeLength<float, &RenderStyle::letterSpacing, &RenderStyle::setLetterSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
#endif

#if ENABLE(IOS_TEXT_AUTOSIZING)
setPropertyHandler(CSSPropertyLineHeight, ApplyPropertyLineHeightForIOSTextAutosizing::createHandler());
#else
Expand Down Expand Up @@ -2528,7 +2536,15 @@ DeprecatedStyleBuilder::DeprecatedStyleBuilder()
setPropertyHandler(CSSPropertyWidows, ApplyPropertyAuto<short, &RenderStyle::widows, &RenderStyle::setWidows, &RenderStyle::hasAutoWidows, &RenderStyle::setHasAutoWidows>::createHandler());
setPropertyHandler(CSSPropertyWidth, ApplyPropertyLength<&RenderStyle::width, &RenderStyle::setWidth, &RenderStyle::initialSize, AutoEnabled, LegacyIntrinsicEnabled, IntrinsicEnabled, NoneDisabled, UndefinedDisabled>::createHandler());
setPropertyHandler(CSSPropertyWordBreak, ApplyPropertyDefault<EWordBreak, &RenderStyle::wordBreak, EWordBreak, &RenderStyle::setWordBreak, EWordBreak, &RenderStyle::initialWordBreak>::createHandler());

// FIXME: We should reconcile the difference in datatype between iOS and OpenSource. On iOS we want word spacing to
// be float for sub-pixel kerning. See <https://bugs.webkit.org/show_bug.cgi?id=20606>.
#if !PLATFORM(IOS)
setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<int, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
#else
setPropertyHandler(CSSPropertyWordSpacing, ApplyPropertyComputeLength<float, &RenderStyle::wordSpacing, &RenderStyle::setWordSpacing, &RenderStyle::initialLetterWordSpacing, NormalEnabled, ThicknessDisabled, SVGZoomEnabled>::createHandler());
#endif

// UAs must treat 'word-wrap' as an alternate name for the 'overflow-wrap' property. So using the same handlers.
setPropertyHandler(CSSPropertyWordWrap, ApplyPropertyDefault<EOverflowWrap, &RenderStyle::overflowWrap, EOverflowWrap, &RenderStyle::setOverflowWrap, EOverflowWrap, &RenderStyle::initialOverflowWrap>::createHandler());
setPropertyHandler(CSSPropertyZIndex, ApplyPropertyAuto<int, &RenderStyle::zIndex, &RenderStyle::setZIndex, &RenderStyle::hasAutoZIndex, &RenderStyle::setHasAutoZIndex>::createHandler());
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/css/MediaFeatureNames.h
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ namespace WebCore {
macro(transform_3d, "-webkit-transform-3d") \
macro(transition, "-webkit-transition") \
macro(animation, "-webkit-animation") \
macro(video_playable_inline, "-webkit-video-playable-inline") \
CSS_MEDIAQUERY_VIEW_MODE(macro)

// end of macro
Expand Down
20 changes: 20 additions & 0 deletions Source/WebCore/css/MediaQueryEvaluator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@
#include "RenderLayerCompositor.h"
#endif

#if PLATFORM(IOS)
#include "WebCoreSystemInterface.h"
#endif

namespace WebCore {

using namespace MediaFeatureNames;
Expand Down Expand Up @@ -624,6 +628,22 @@ static bool view_modeMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* fram
}
#endif // ENABLE(VIEW_MODE_CSS_MEDIA)

// FIXME: Find a better place for this function. Maybe ChromeClient?
static inline bool isRunningOnIPhoneOrIPod()
{
#if PLATFORM(IOS)
static wkDeviceClass deviceClass = iosDeviceClass();
return deviceClass == wkDeviceClassiPhone || deviceClass == wkDeviceClassiPod;
#else
return false;
#endif
}

static bool video_playable_inlineMediaFeatureEval(CSSValue*, RenderStyle*, Frame* frame, MediaFeaturePrefix)
{
return !isRunningOnIPhoneOrIPod() || frame->settings().mediaPlaybackAllowsInline();
}

enum PointerDeviceType { TouchPointer, MousePointer, NoPointer, UnknownPointer };

static PointerDeviceType leastCapablePrimaryPointerDeviceType(Frame* frame)
Expand Down
13 changes: 12 additions & 1 deletion Source/WebCore/css/StyleResolver.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -712,7 +712,7 @@ bool StyleResolver::canShareStyleWithElement(StyledElement* element) const

#if ENABLE(PLUGIN_PROXY_FOR_VIDEO)
// With proxying, the media elements are backed by a RenderEmbeddedObject.
if ((element->hasTagName(videoTag) || element->hasTagName(audioTag)) && toMediaElement(element)->shouldUseVideoPluginProxy())
if ((element->hasTagName(videoTag) || element->hasTagName(audioTag)) && toHTMLMediaElement(element)->shouldUseVideoPluginProxy())
return false;
#endif

Expand Down Expand Up @@ -2609,6 +2609,17 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value)
state.style()->setTouchCalloutEnabled(primitiveValue->getStringValue().lower() != "none");
return;
}

// FIXME: CSSPropertyWebkitCompositionFillColor shouldn't be iOS-specific. Once we fix up its usage in
// InlineTextBox::paintCompositionBackground() we should move it outside the PLATFORM(IOS)-guard.
// See <https://bugs.webkit.org/show_bug.cgi?id=126296>.
case CSSPropertyWebkitCompositionFillColor: {
HANDLE_INHERIT_AND_INITIAL(compositionFillColor, CompositionFillColor);
if (!primitiveValue)
break;
state.style()->setCompositionFillColor(colorFromPrimitiveValue(primitiveValue));
return;
}
#endif
#if ENABLE(TOUCH_EVENTS)
case CSSPropertyWebkitTapHighlightColor: {
Expand Down

0 comments on commit 4c77853

Please sign in to comment.