AX: Implement updated CSS3 Speech for 'speak' and 'speak-as' properties
[WebKit-https.git] / Source / WebCore / css / CSSComputedStyleDeclaration.cpp
index d33e2cd..d6b421d 100644 (file)
@@ -53,6 +53,7 @@
 #include "CursorList.h"
 #include "DeprecatedCSSOMValue.h"
 #include "Document.h"
+#include "DocumentTimeline.h"
 #include "FontCascade.h"
 #include "FontSelectionValueInlines.h"
 #include "FontTaggedSettings.h"
@@ -204,7 +205,7 @@ static const CSSPropertyID computedProperties[] = {
     CSSPropertyPosition,
     CSSPropertyResize,
     CSSPropertyRight,
-    CSSPropertySpeak,
+    CSSPropertySpeakAs,
     CSSPropertyTableLayout,
     CSSPropertyTabSize,
     CSSPropertyTextAlign,
@@ -1826,6 +1827,25 @@ static Ref<CSSValue> renderEmphasisPositionFlagsToCSSValue(TextEmphasisPosition
     return WTFMove(list);
 }
 
+static Ref<CSSValue> speakAsToCSSValue(ESpeakAs speakAs)
+{
+    auto& cssValuePool = CSSValuePool::singleton();
+    auto list = CSSValueList::createSpaceSeparated();
+    if (speakAs & SpeakNormal)
+        list->append(cssValuePool.createIdentifierValue(CSSValueNormal));
+    if (speakAs & SpeakSpellOut)
+        list->append(cssValuePool.createIdentifierValue(CSSValueSpellOut));
+    if (speakAs & SpeakDigits)
+        list->append(cssValuePool.createIdentifierValue(CSSValueDigits));
+    if (speakAs & SpeakLiteralPunctuation)
+        list->append(cssValuePool.createIdentifierValue(CSSValueLiteralPunctuation));
+    if (speakAs & SpeakNoPunctuation)
+        list->append(cssValuePool.createIdentifierValue(CSSValueNoPunctuation));
+    if (!list->length())
+        return cssValuePool.createIdentifierValue(CSSValueNormal);
+    return WTFMove(list);
+}
+    
 static Ref<CSSValue> hangingPunctuationToCSSValue(HangingPunctuation hangingPunctuation)
 {
     auto& cssValuePool = CSSValuePool::singleton();
@@ -2360,6 +2380,8 @@ RenderElement* ComputedStyleExtractor::styledRenderer() const
         return nullptr;
     if (m_pseudoElementSpecifier != NOPSEUDO && element == m_element.get())
         return nullptr;
+    if (element->hasDisplayContents())
+        return nullptr;
     return element->renderer();
 }
 
@@ -2447,7 +2469,10 @@ static inline const RenderStyle* computeRenderStyleForProperty(Element& element,
     auto* renderer = element.renderer();
 
     if (renderer && renderer->isComposited() && CSSAnimationController::supportsAcceleratedAnimationOfProperty(propertyID)) {
-        ownedStyle = renderer->animation().animatedStyleForRenderer(*renderer);
+        if (auto timeline = element.document().existingTimeline())
+            ownedStyle = timeline->animatedStyleForRenderer(*renderer);
+        else
+            ownedStyle = renderer->animation().animatedStyleForRenderer(*renderer);
         if (pseudoElementSpecifier && !element.isPseudoElement()) {
             // FIXME: This cached pseudo style will only exist if the animation has been run at least once.
             return ownedStyle->getCachedPseudoStyle(pseudoElementSpecifier);
@@ -3688,8 +3713,8 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             rect->setLeft(autoOrZoomAdjustedValue(style->clip().left(), *style));
             return cssValuePool.createValue(WTFMove(rect));
         }
-        case CSSPropertySpeak:
-            return cssValuePool.createValue(style->speak());
+        case CSSPropertySpeakAs:
+            return speakAsToCSSValue(style->speakAs());
         case CSSPropertyTransform:
             return computedTransform(renderer, *style);
         case CSSPropertyTransformBox: