Source/WebCore/ChangeLog

 12017-11-16 Antoine Quint <graouts@apple.com>
 2
 3 Clean up KeyframeEffect
 4 https://bugs.webkit.org/show_bug.cgi?id=179777
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 A few review comments came in after https://bugs.webkit.org/show_bug.cgi?id=179707 landed,
 9 addressing them with this follow-up patch.
 10
 11 * animation/KeyframeEffect.cpp:
 12 (WebCore::KeyframeEffect::create): Use "keyframeEffect" instead of "result" for clarity.
 13 (WebCore::KeyframeEffect::processKeyframes): Use consistent index and length types while iterating
 14 over properties in PropertyNameArray and explicitly size the properties array since we already
 15 know its final size.
 16 * dom/Element.cpp:
 17 (WebCore::Element::getAnimations):
 18
1192017-11-15 Zalan Bujtas <zalan@apple.com>
220
321 AX triggers sync layout while building the render tree on www.macrumors.com.

Source/WebCore/animation/KeyframeEffect.cpp

@@using namespace JSC;
3737
3838ExceptionOr<Ref<KeyframeEffect>> KeyframeEffect::create(ExecState& state, Element* target, Strong<JSObject>&& keyframes)
3939{
40  auto result = adoptRef(*new KeyframeEffect(target));
 40 auto keyframeEffect = adoptRef(*new KeyframeEffect(target));
4141
42  auto setKeyframesResult = result->setKeyframes(state, WTFMove(keyframes));
 42 auto setKeyframesResult = keyframeEffect->setKeyframes(state, WTFMove(keyframes));
4343 if (setKeyframesResult.hasException())
4444 return setKeyframesResult.releaseException();
4545
46  return WTFMove(result);
 46 return WTFMove(keyframeEffect);
4747}
4848
4949KeyframeEffect::KeyframeEffect(Element* target)

@@ExceptionOr<void> KeyframeEffect::processKeyframes(ExecState& state, Strong<JSOb
7979 StyleResolver& styleResolver = m_target->styleResolver();
8080 auto parserContext = CSSParserContext(HTMLStandardMode);
8181
82  const auto* array = jsCast<const JSArray*>(keyframes.get());
 82 auto* array = jsCast<const JSArray*>(keyframes.get());
8383 auto length = array->length();
8484 if (length != 2)
8585 return Exception { TypeError };

@@ExceptionOr<void> KeyframeEffect::processKeyframes(ExecState& state, Strong<JSOb
9494 size_t numberOfProperties = ownPropertyNames.size();
9595
9696 StringBuilder cssText;
97  for (unsigned j = 0; j < numberOfProperties; ++j) {
 97 for (size_t j = 0; j < numberOfProperties; ++j) {
9898 cssText.append(ownPropertyNames[j].string());
9999 cssText.appendLiteral(": ");
100100 cssText.append(keyframe->get(&state, ownPropertyNames[j]).toWTFString(&state));

@@ExceptionOr<void> KeyframeEffect::processKeyframes(ExecState& state, Strong<JSOb
106106 styleProperties->parseDeclaration(cssText.toString(), parserContext);
107107 unsigned numberOfCSSProperties = styleProperties->propertyCount();
108108
109  Vector<CSSPropertyID> properties;
 109 Vector<CSSPropertyID> properties(numberOfCSSProperties);
110110 for (unsigned k = 0; k < numberOfCSSProperties; ++k) {
111  properties.append(styleProperties->propertyAt(k).id());
 111 properties.uncheckedAppend(styleProperties->propertyAt(k).id());
112112 styleResolver.applyPropertyToStyle(styleProperties->propertyAt(k).id(), styleProperties->propertyAt(k).value(), WTFMove(renderStyle));
113113 renderStyle = styleResolver.state().takeStyle();
114114 }

Source/WebCore/dom/Element.cpp

@@Vector<RefPtr<WebAnimation>> Element::getAnimations()
37083708 // FIXME: Filter and order the list as specified (webkit.org/b/179535).
37093709 if (auto timeline = document().existingTimeline())
37103710 return timeline->animationsForElement(*this);
3711  return Vector<RefPtr<WebAnimation>> { };
 3711 return { };
37123712}
37133713
37143714AccessibleNode* Element::accessibleNode()