source: webkit/trunk/Source/WebCore/css/CSSKeyframeRule.cpp

Last change on this file was 283049, checked in by Devin Rousso, 4 years ago

Add typechecking is overloads for std::unique_ptr, WTF::UniqueRef, and WTF::WeakPtr
https://bugs.webkit.org/show_bug.cgi?id=230734

Reviewed by Chris Dumez.

Source/WebCore:

  • accessibility/AccessibilityListBoxOption.cpp:

(WebCore::AccessibilityListBoxOption::isEnabled const):
(WebCore::AccessibilityListBoxOption::isSelected const):
(WebCore::AccessibilityListBoxOption::canSetSelectedAttribute const):

  • accessibility/AccessibilityScrollView.cpp:

(WebCore::AccessibilityScrollView::webAreaObject const):
(WebCore::AccessibilityScrollView::documentFrameView const):
(WebCore::AccessibilityScrollView::parentObject const):
(WebCore::AccessibilityScrollView::parentObjectIfExists const):

  • animation/CSSPropertyAnimation.cpp:

(WebCore::blendFunc):

  • bindings/js/JSAbstractRangeCustom.cpp:

(WebCore::toJSNewlyCreated):

  • css/CSSCounterStyleRule.cpp:

(WebCore::StyleRuleCounterStyle::mutableProperties):

  • css/CSSCursorImageValue.cpp:

(WebCore::CSSCursorImageValue::CSSCursorImageValue):
(WebCore::CSSCursorImageValue::selectBestFitImage):

  • css/CSSFontFaceSource.cpp:

(WebCore::CSSFontFaceSource::isSVGFontFaceSource const):

  • css/CSSFontFaceSrcValue.cpp:

(WebCore::CSSFontFaceSrcValue::fontLoadRequest):

  • css/CSSFontSelector.cpp:

(WebCore::CSSFontSelector::updateStyleIfNeeded):
(WebCore::CSSFontSelector::fontRangesForFamily):
(WebCore::CSSFontSelector::fallbackFontAt):

  • css/CSSKeyframeRule.cpp:

(WebCore::StyleRuleKeyframe::mutableProperties):

  • css/StyleRule.cpp:

(WebCore::StyleRule::mutableProperties):
(WebCore::StyleRulePage::mutableProperties):
(WebCore::StyleRuleFontFace::mutableProperties):

  • css/calc/CSSCalcOperationNode.cpp:

(WebCore::CSSCalcOperationNode::hoistChildrenWithOperator):
(WebCore::CSSCalcOperationNode::combineChildren):

  • css/typedom/CSSStyleValueFactory.cpp:

(WebCore::CSSStyleValueFactory::reifyValue):

  • editing/TextManipulationController.cpp:

(WebCore::TextManipulationController::scheduleObservationUpdate):
(WebCore::TextManipulationController::replace):

  • editing/cocoa/WebContentReaderCocoa.mm:

(WebCore::replaceRichContentWithAttachments):

  • html/FormController.cpp:

(WebCore::FormController::restoreControlStateIn):

  • html/HTMLCanvasElement.cpp:

(WebCore::HTMLCanvasElement::reset):
(WebCore::HTMLCanvasElement::getImageData):
(WebCore::HTMLCanvasElement::virtualHasPendingActivity const):

  • html/HTMLFormElement.cpp:

(WebCore::HTMLFormElement::checkInvalidControlsAndCollectUnhandled):

  • html/OffscreenCanvas.cpp:

(WebCore::OffscreenCanvas::reset):

  • html/track/TextTrack.cpp:

(WebCore::TextTrack::addCue):

  • inspector/agents/InspectorDOMAgent.cpp:

(WebCore::InspectorDOMAgent::buildObjectForEventListener):

  • page/FrameViewLayoutContext.cpp:

(WebCore::FrameViewLayoutContext::layout):

  • platform/graphics/avfoundation/objc/SourceBufferPrivateAVFObjC.mm:

(WebCore::SourceBufferPrivateAVFObjC::streamDataParser const):

  • platform/graphics/ca/cocoa/PlatformCAAnimationCocoa.mm:

(WebCore::PlatformCAAnimationCocoa::setAnimations):

  • platform/graphics/ca/win/PlatformCAAnimationWin.cpp:

(PlatformCAAnimationWin::setAnimations):

  • rendering/RenderImageResource.cpp:

(WebCore::RenderImageResource::imageSize const):

  • rendering/updating/RenderTreeBuilder.cpp:

(WebCore::RenderTreeBuilder::destroy):

  • rendering/updating/RenderTreeBuilderTable.cpp:

(WebCore::RenderTreeBuilder::Table::attach):

Source/WebKit:

  • WebProcess/WebPage/WebPage.cpp:

(WebKit::WebPage::setTextAsync):

  • WebProcess/WebPage/ios/WebPageIOS.mm:

(WebKit::WebPage::commitPotentialTap):
(WebKit::WebPage::performActionOnElement):
(WebKit::WebPage::autofillLoginCredentials):

Source/WebKitLegacy/win:

  • WebFrame.cpp:

(WebFrame::elementWithName):

Source/WTF:

  • wtf/StdLibExtras.h:
  • wtf/TypeCasts.h:

(WTF::is):

  • wtf/UniqueRef.h:

(WTF::GetPtrHelper<UniqueRef<T>>::getPtr): Added.
(WTF::is): Added.

  • wtf/WeakPtr.h:

(WTF::is): Added.

  • Property svn:eol-style set to native
File size: 3.9 KB
Line 
1/*
2 * Copyright (C) 2007, 2008, 2012, 2014 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
12 *
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
24 */
25
26#include "config.h"
27#include "CSSKeyframeRule.h"
28
29#include "CSSKeyframesRule.h"
30#include "CSSParser.h"
31#include "PropertySetCSSStyleDeclaration.h"
32#include "StyleProperties.h"
33#include <wtf/text/StringBuilder.h>
34
35namespace WebCore {
36
37StyleRuleKeyframe::StyleRuleKeyframe(Ref<StyleProperties>&& properties)
38 : StyleRuleBase(StyleRuleType::Keyframe)
39 , m_properties(WTFMove(properties))
40{
41}
42
43StyleRuleKeyframe::StyleRuleKeyframe(Vector<double>&& keys, Ref<StyleProperties>&& properties)
44 : StyleRuleBase(StyleRuleType::Keyframe)
45 , m_properties(WTFMove(properties))
46 , m_keys(WTFMove(keys))
47{
48}
49
50Ref<StyleRuleKeyframe> StyleRuleKeyframe::create(Ref<StyleProperties>&& properties)
51{
52 return adoptRef(*new StyleRuleKeyframe(WTFMove(properties)));
53}
54
55Ref<StyleRuleKeyframe> StyleRuleKeyframe::create(Vector<double>&& keys, Ref<StyleProperties>&& properties)
56{
57 return adoptRef(*new StyleRuleKeyframe(WTFMove(keys), WTFMove(properties)));
58}
59
60StyleRuleKeyframe::~StyleRuleKeyframe() = default;
61
62MutableStyleProperties& StyleRuleKeyframe::mutableProperties()
63{
64 if (!is<MutableStyleProperties>(m_properties))
65 m_properties = m_properties->mutableCopy();
66 return downcast<MutableStyleProperties>(m_properties.get());
67}
68
69String StyleRuleKeyframe::keyText() const
70{
71 StringBuilder keyText;
72 for (size_t i = 0; i < m_keys.size(); ++i) {
73 if (i)
74 keyText.append(',');
75 keyText.append(m_keys[i] * 100, '%');
76 }
77 return keyText.toString();
78}
79
80bool StyleRuleKeyframe::setKeyText(const String& keyText)
81{
82 ASSERT(!keyText.isNull());
83 auto keys = CSSParser::parseKeyframeKeyList(keyText);
84 if (keys.isEmpty())
85 return false;
86 m_keys = WTFMove(keys);
87 return true;
88}
89
90String StyleRuleKeyframe::cssText() const
91{
92 if (auto declarations = m_properties->asText(); !declarations.isEmpty())
93 return makeString(keyText(), " { ", declarations, " }");
94 return makeString(keyText(), " { }");
95}
96
97CSSKeyframeRule::CSSKeyframeRule(StyleRuleKeyframe& keyframe, CSSKeyframesRule* parent)
98 : CSSRule(nullptr)
99 , m_keyframe(keyframe)
100{
101 setParentRule(parent);
102}
103
104CSSKeyframeRule::~CSSKeyframeRule()
105{
106 if (m_propertiesCSSOMWrapper)
107 m_propertiesCSSOMWrapper->clearParentRule();
108}
109
110CSSStyleDeclaration& CSSKeyframeRule::style()
111{
112 if (!m_propertiesCSSOMWrapper)
113 m_propertiesCSSOMWrapper = StyleRuleCSSStyleDeclaration::create(m_keyframe->mutableProperties(), *this);
114 return *m_propertiesCSSOMWrapper;
115}
116
117void CSSKeyframeRule::reattach(StyleRuleBase&)
118{
119 // No need to reattach, the underlying data is shareable on mutation.
120 ASSERT_NOT_REACHED();
121}
122
123} // namespace WebCore
Note: See TracBrowser for help on using the repository browser.