Remove PassRefPtr from more of "platform"
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Jan 2017 03:35:54 +0000 (03:35 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 14 Jan 2017 03:35:54 +0000 (03:35 +0000)
https://bugs.webkit.org/show_bug.cgi?id=166809

Reviewed by Sam Weinig.

Source/JavaScriptCore:

* inspector/JSInjectedScriptHost.h:
(Inspector::JSInjectedScriptHost::impl): Simplified code since we don't need a
const_cast here any more.
* runtime/PrivateName.h:
(JSC::PrivateName::uid): Ditto.

Source/WebCore:

* CMakeLists.txt: Removed DeviceMotionClientMock.cpp.

* Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.h:
Added now-needed include.

* Modules/speech/SpeechSynthesisUtterance.cpp:
(WebCore::SpeechSynthesisUtterance::SpeechSynthesisUtterance):
Pass a reference instead of a pointer.

* Modules/speech/SpeechSynthesisUtterance.h: Tweaks, msade a few things
more private and final.

* bindings/js/JSDOMConvert.h:
(WebCore::Detail::getPtrOrRef): Removed no-longer-needed const_cast.
* bindings/js/JSDOMWrapper.h:
(WebCore::JSDOMWrapper::wrapped): Ditto.
* bindings/js/ScriptModuleLoader.cpp:
(WebCore::ScriptModuleLoader::~ScriptModuleLoader): Ditto.

* css/BasicShapeFunctions.cpp:
(WebCore::convertToLengthSize): Updated for LengthSize struct.
(WebCore::convertToCenterCoordinate): Ditto.

* css/CSSComputedStyleDeclaration.cpp:
(WebCore::createPositionListForLayer): Take a reference.
(WebCore::getBorderRadiusCornerValues): Updated for LengthSize struct.
(WebCore::getBorderRadiusCornerValue): Ditto.
(WebCore::getBorderRadiusShorthandValue): Ditto.
(WebCore::fillSizeToCSSValue): Ditto.
(WebCore::ComputedStyleExtractor::propertyValue): Updated many properties
since the layer properties now return references rather than pointers.

* css/CSSImageGeneratorValue.cpp:
(WebCore::CSSImageGeneratorValue::CachedGeneratedImage::image): Removed
no-longer-needed const_cast.
* css/CSSKeyframesRule.cpp:
(WebCore::CSSKeyframesRule::item): Ditto.

* css/CSSPrimitiveValue.cpp:
(WebCore::CSSPrimitiveValue::init): Updated for LengthSize struct.

* css/CSSStyleRule.h: Removed no-longer-needed const_cast.

* css/CSSToStyleMap.cpp:
(WebCore::convertToLengthSize): Updated for LengthSize struct.

* css/FontFace.cpp:
(WebCore::FontFace::family): Removed no-longer-needed const_cast.
(WebCore::FontFace::style): Ditto.
(WebCore::FontFace::weight): Ditto.
(WebCore::FontFace::unicodeRange): Ditto.
(WebCore::FontFace::variant): Ditto.
(WebCore::FontFace::featureSettings): Ditto.

* css/LengthFunctions.cpp:
(WebCore::sizeForLengthSize): Added.
(WebCore::floatSizeForLengthSize): Updated for LengthSize struct.
* css/LengthFunctions.h: Added sizeForLengthSize.

* css/SVGCSSComputedStyleDeclaration.cpp:
(WebCore::paintOrder): Cut down on creation of unused objects.
We now create only what we actually use.

* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertRadius): Updated for
LengthSize struct.
(WebCore::StyleBuilderConverter::convertShapeValue): Pass references
when creating ShapeValue.

* css/StyleBuilderCustom.h:
(WebCore::forwardInheritedValue): Added. This set of overloaded
functions allows us to use move semantics for some types, but copy
them when inheriting. Doing it with special cases here allows us to
resolve this without adding overloads someone might be tempted to
call outside the style builder, and without adding special cases to
the JSON file for each property.
(WebCore::StyleBuilderCustom::applyValueWebkitDashboardRegion):
Add WTFMove as needed to work with rvalue references.
(WebCore::StyleBuilderCustom::applyValueSize): Ditto.
(WebCore::StyleBuilderCustom::applyInheritTextIndent): Ditto.
(WebCore::StyleBuilderCustom::applyValueTextIndent): Ditto.
(WebCore::StyleBuilderCustom::applyInheritLineHeight): Ditto.
(WebCore::StyleBuilderCustom::applyValueLineHeight): Ditto.
(WebCore::StyleBuilderCustom::applyInheritClip): Ditto.
(WebCore::StyleBuilderCustom::applyValueClip): Ditto.

* css/StyleResolver.cpp:
(WebCore::StyleResolver::State::cacheBorderAndBackground): Use
references instead of pointers.
(WebCore::StyleResolver::applyMatchedProperties): Ditto.
(WebCore::StyleResolver::applyProperty): Update for changes to the
custom property data in RenderStyle.

* css/makeprop.pl: Use auto quite a bit more in the generated code.
Updated special cases for layers to expect references. Added a WTFMove
so we can get move semantics for converted values that come out in
an optional. Added call to forwardInheritedValue (see above).

* dom/Document.cpp:
(WebCore::Document::pageSizeAndMarginsInPixels): Use auto and update
since LengthSize is a struct.

* dom/EventPath.cpp:
(WebCore::EventPath::computePathUnclosedToTarget): Use auto.

* dom/LiveNodeList.h:
(WebCore::LiveNodeList::ownerNode): Removed no-longer-needed const_cast.

* dom/MessageEvent.cpp:
(WebCore::MessageEvent::source): Removed unneeded static_cast.

* dom/Node.cpp:
(WebCore::nodeSetPreTransformedFromNodeOrStringVector): Tweaked formatting.

* dom/Range.h:
(WebCore::Range::ownerDocument): Removed no-longer-needed const_cast.
* dom/RegisteredEventListener.h:
(WebCore::RegisteredEventListener::callback): Ditto.
* dom/ScriptRunner.cpp:
(WebCore::ScriptRunner::~ScriptRunner): Ditto.
* html/HTMLCollection.h:
(WebCore::HTMLCollection::ownerNode): Ditto.
* html/parser/HTMLStackItem.h:
(WebCore::HTMLStackItem::node): Ditto.

* inspector/PageScriptDebugServer.cpp:
(WebCore::PageScriptDebugServer::setJavaScriptPaused): Cut down on the number
of different functions here. Also use reference rather than pointer.
* inspector/PageScriptDebugServer.h: Updated for above change.

* loader/HistoryController.cpp:
(WebCore::HistoryController::recursiveSetProvisionalItem): Removed
no-longer-needed const_cast.
(WebCore::HistoryController::recursiveGoToItem): Ditto.

* page/Frame.cpp:
(WebCore::Frame::ownerRenderer): Use auto. Let the is<> function do null
checking for us.
(WebCore::Frame::frameForWidget): Take a reference rather than a pointer.
* page/Frame.h: Updated for the above.

* page/FrameView.cpp:
(WebCore::FrameView::invalidateRect): Use Chrome directly instead of using
HostWindow. HostWindow is an abstraction for the platform layer, and there
is no good reason to use it here.
(WebCore::FrameView::scheduleAnimation): Ditto.
(WebCore::FrameView::graphicsLayerForPlatformWidget): Updated to use reference
when calling RenderWidget::find.
(WebCore::FrameView::scrollContentsFastPath): Use Chrome instead of HostWindow.
(WebCore::FrameView::hostWindow): Use early return.
(WebCore::FrameView::updateScrollCorner): Removed unneeded call through to base
class function, which was empty.
(WebCore::FrameView::hasCustomScrollbars): Updated since the children set now
contains Ref rather than RefPtr.
(WebCore::FrameView::parentFrameView): Use early return.
(WebCore::FrameView::updateWidgetPositions): Use reference instead of pointer.
* page/FrameView.h: Use final instead of override. Remove now-unneeded const_cast.

* page/Page.cpp:
(WebCore::Page::pluginViews): Updated since the children set now contains
Ref rather than RefPtr.

* page/PrintContext.cpp:
(WebCore::PrintContext::pageProperty): Updated for LengthSize struct.

* page/animation/AnimationBase.cpp:
(WebCore::AnimationBase::fireAnimationEventsIfNeeded): Updated for changes to
the types in animation function members.
(WebCore::AnimationBase::timeToNextService): Ditto.
(WebCore::AnimationBase::progress): Ditto.
(WebCore::AnimationBase::getElapsedTime): Ditto.

* page/animation/CSSPropertyAnimation.cpp:
(WebCore::blendFunc): Updated for LengthSize struct.
(WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Updated since we now
use rvalue references and move semantics when setting length properties.

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame): Tweaked to
use auto, pass references.

* platform/KeyedCoding.h: Return RefPtr instead of PassRefPtr.

* platform/LengthBox.h: Added a constructor that moves the lengths in, rather
than always copying them.

* platform/LengthSize.cpp:
(WebCore::operator<<): Updated since LengthSize is a struct.
* platform/LengthSize.h: Turned LengthSize into a struct and removed all the
getter and setter code.

* platform/PlatformSpeechSynthesis.h: Removed. Unused.

* platform/PlatformSpeechSynthesisUtterance.cpp:
(WebCore::PlatformSpeechSynthesisUtterance::create): Return Ref rather than PassRefPtr.
(WebCore::PlatformSpeechSynthesisUtterance::PlatformSpeechSynthesisUtterance): Take
a reference. Initialize data members in class definition.
* platform/PlatformSpeechSynthesisUtterance.h: Updated for the above.

* platform/PlatformSpeechSynthesisVoice.cpp:
(WebCore::PlatformSpeechSynthesisVoice::create): Return Ref rather than PassRefPtr.
* platform/PlatformSpeechSynthesisVoice.h: Updated for the above.

* platform/ScrollView.cpp:
(WebCore::ScrollView::addChild): Take a reference rather than a PassRefPtr.
(WebCore::ScrollView::setHasScrollbarInternal): Updated for change to addChild
(WebCore::ScrollView::scrollContentsFastPath): Deleted. This was never called,
so made it pure virtual.
(WebCore::ScrollView::frameRectsChanged): Use a modern for loop.
(WebCore::ScrollView::clipRectChanged): Ditto.
(WebCore::ScrollView::updateScrollCorner): Deleted. This was empty so made it pure
virtual and changed FrameView to not call it.
(WebCore::ScrollView::setParentVisible): Use a modern for loop.
(WebCore::ScrollView::show): Ditto.
(WebCore::ScrollView::hide): Ditto.
* platform/ScrollView.h: Changed the children set to contain Ref instead of RefPtr.
Changed functions that were never overridden to either be final or non-virtual,
Changed functions that were never called to be pure virtual.

* platform/Theme.h:
(WebCore::Theme::minimumControlSize): Updated for LengthSize struct.

* platform/animation/Animation.h: Changed timingFunction and trigger to return
raw pointers instead of PassRefPtr. Changed setTimingFunction and setTrigger to
take RefPtr&& and Ref&& instead of PassRefPtr. CHanged initialTimingfunction and
initialTrigger to return Ref.

* platform/animation/AnimationList.cpp: Removed redundant check in FILL_UNSET_PROPERTY.
(WebCore::AnimationList::AnimationList): Use modern for loop, reserveInitialCapacity,
and uncheckedAppend.
* platform/animation/AnimationList.h: Changed append to take Ref&& instead of PassRefPtr.
changed vecto to contain Ref instead of RefPtr. Added move constructor and assignment
operator.

* platform/animation/AnimationTrigger.h:
(WebCore::AutoAnimationTrigger::clone): Return Ref instead of PassRefPtr.
(WebCore::AutoAnimationTrigger::create): Ditto.
(WebCore::AutoAnimationTrigger::clone): Ditto.
(WebCore::ScrollAnimationTrigger::create): Ditto.
(WebCore::ScrollAnimationTrigger::clone): Ditto.

* platform/animation/TimingFunction.h:
(WebCore::LinearTimingFunction::create): Return Ref instead of PassRefPtr.
(WebCore::CubicBezierTimingFunction::create): Ditto.
(WebCore::CubicBezierTimingFunction::defaultTimingFunction): Return a reference
instead of a pointer.
(WebCore::CubicBezierTimingFunction::createReversed): Return Ref instead of PassRefPtr.
(WebCore::CubicBezierTimingFunction::clone): Ditto.
(WebCore::StepsTimingFunction::create): Ditto.
(WebCore::StepsTimingFunction::clone): Ditto.
(WebCore::SpringTimingFunction::create): Ditto.
(WebCore::SpringTimingFunction::clone): Ditto.

* platform/audio/AudioBus.h:
(WebCore::AudioBus::channel): Removed no-longer-needed const_cast.

* platform/cf/KeyedEncoderCF.cpp:
(WebCore::KeyedEncoderCF::finishEncoding): Return RefPtr instead of PassRefPtr.
* platform/cf/KeyedEncoderCF.h: Use final instead of override. Made even more
private. Changed return value of finishEncoding to Ref instead of PassRefPtr.

* platform/efl/PlatformSpeechSynthesisProviderEfl.h: Removed include of PassRefPtr.h.

* platform/glib/KeyedEncoderGlib.cpp:
(WebCore::KeyedEncoderGlib::finishEncoding): Return RefPtr instead of PassRefPtr.
* platform/glib/KeyedEncoderGlib.h: Use final instead of override. Made even more
private. Changed return value of finishEncoding to Ref instead of PassRefPtr.

* platform/graphics/filters/FilterOperations.cpp:
(WebCore::outsetSizeForBlur): Simplified, removing unnecessary floating point math.
(WebCore::FilterOperations::FilterOperations): Deleted. Let the compiler generate this.
(WebCore::FilterOperations::operator=): Deleted. Let the compiler generate this.
(WebCore::FilterOperations::operator==): Streamlined.
(WebCore::FilterOperations::operationsMatch): Ditto.
(WebCore::FilterOperations::hasReferenceFilter): Ditto.
(WebCore::FilterOperations::hasOutsets): Ditto.
(WebCore::FilterOperations::outsets): Ditto.
(WebCore::FilterOperations::hasFilterThatAffectsOpacity): Ditto.
(WebCore::FilterOperations::hasFilterThatMovesPixels): Ditto.
* platform/graphics/filters/FilterOperations.h: Updated for above changes.

* platform/graphics/FontCache.h: Removed included of PassRefPtr.h.

* platform/graphics/FontPlatformData.h: Tweaked formatting. Removed nesting
from #if since our formatting makes it hard to see nesting. Let the compiler
generate the default move and copy constructors and assignemnt operators except
in the USE(FREETYPE) case.

* platform/graphics/GraphicsLayer.h:
(WebCore::AnimationValue::AnimationValue): Updated since clone now returns a Ref
rather than a RefPtr.
(WebCore::FloatAnimationValue::FloatAnimationValue): Deleted. Let the compiler
generate the copy constructor without defining it explicitly.
(WebCore::TransformAnimationValue::TransformAnimationValue): Use a modern for
loop, reserveInitialCapacity, and unchecked append. Also tell the compiler to
generate the move constructor, since the special work is only needed for the
copy constructor.
(WebCore::FilterAnimationValue::FilterAnimationValue): Ditto.
(WebCore::KeyframeValueList::KeyframeValueList): Ditto.

* platform/graphics/LegacyCDMSession.h: Removed include of PassRefPtr.h.

* platform/graphics/PathUtilities.cpp:
(WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline): Updated
for LengthSize struct.

* platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
(WebCore::CDMSessionAVFoundationCF::CDMSessionAVFoundationCF): Take a reference.
Don't bother setting m_client since we never use it.
(WebCore::CDMSessionAVFoundationCF::generateKeyRequest): Clean up code a bit
by using auto a lot more.
* platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h: Added include
that is now needed since it was removed from the base class. Tidied the class
up a bit, marking it final, making everything private, taking a reference, and
removing an unused data member, m_client.

* platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
(WebCore::MediaPlayerPrivateAVFoundationCF::createSession): Pass a reference.

* platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
added include of WTFString.h, now needed because of removing an unneeded
include from another header file.

* platform/graphics/ca/GraphicsLayerCA.cpp:
(WebCore::GraphicsLayerCA::animationCanBeAccelerated): Updated since trigger
is a raw pointer now.
(WebCore::GraphicsLayerCA::timingFunctionForAnimationValue): Updated to
return a reference rather than a pointer.
(WebCore::GraphicsLayerCA::setAnimationEndpoints): Updated for the above change.
(WebCore::GraphicsLayerCA::setAnimationKeyframes): Ditto.
(WebCore::GraphicsLayerCA::setTransformAnimationEndpoints): Ditto.
(WebCore::GraphicsLayerCA::setTransformAnimationKeyframes): Ditto.
(WebCore::GraphicsLayerCA::setFilterAnimationEndpoints): Ditto.
(WebCore::GraphicsLayerCA::setFilterAnimationKeyframes): Ditto.
* platform/graphics/ca/GraphicsLayerCA.h: Ditto.

* platform/ios/PlatformSpeechSynthesizerIOS.mm:
(-[WebSpeechSynthesisWrapper speakUtterance:]): CHanged argument to be a
RefPtr&& instead of a PassRefPtr.

* platform/mac/ThemeMac.mm:
(WebCore::sizeFromNSControlSize): Updated for LenghtSize struct.
(WebCore::checkboxSize): Ditto.
(WebCore::radioSize): Ditto.
(WebCore::ThemeMac::controlSize): Ditto.
(WebCore::ThemeMac::minimumControlSize): Ditto.

* platform/mac/WidgetMac.mm:
(WebCore::Widget::setFocus): Updated to pass a reference.

* platform/mock/DeviceMotionClientMock.cpp: Removed. Unused.
* platform/mock/DeviceMotionClientMock.h: Removed. Unused.

* platform/win/CursorWin.cpp:
(WebCore::createSharedCursor): Return a Ref instead of a PassRefPtr.
(WebCore::loadSharedCursor): Ditto.
(WebCore::loadCursorByName): Ditto.

* rendering/FilterEffectRenderer.cpp:
(WebCore::FilterEffectRenderer::output): Removed a no-longer-needed const_cast.
(WebCore::FilterEffectRenderer::outputRect): Ditto.

* rendering/ImageQualityController.cpp:
(WebCore::ImageQualityController::chooseInterpolationQuality): Tweaked formatting.

* rendering/InlineFlowBox.cpp:
(WebCore::InlineFlowBox::paintFillLayers): Updated to take a reference. Also
used a vector to iterate the linked list in reverse order instead of recursion.
(WebCore::InlineFlowBox::paintFillLayer): Take a reference.
(WebCore::InlineFlowBox::paintMask):
* rendering/InlineFlowBox.h: Updated for the above.

* rendering/RenderBox.cpp:
(WebCore::RenderBox::paintRootBoxFillLayers): Use auto a bit.
(WebCore::RenderBox::getBackgroundPaintedExtent): Use reference for the layers.
(WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect): Ditto.
(WebCore::RenderBox::backgroundHasOpaqueTopLayer): Ditto.
(WebCore::RenderBox::paintMaskImages): Ditto.
(WebCore::RenderBox::maskClipRect): Ditto.
(WebCore::RenderBox::paintFillLayers): Ditto.
(WebCore::RenderBox::paintFillLayer): Ditto.
(WebCore::layersUseImage): Ditto.
(WebCore::RenderBox::repaintLayerRectsForImage): Ditto.
* rendering/RenderBox.h: Updated for the above.

* rendering/RenderBoxModelObject.cpp:
(WebCore::RenderBoxModelObject::paintFillLayerExtended): Use reference for
the layers.
(WebCore::RenderBoxModelObject::calculateFillTileSize): Ditto.
(WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Ditto.
(WebCore::RenderBoxModelObject::getGeometryForBackgroundImage): Ditto.
(WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground): Ditto.
* rendering/RenderBoxModelObject.h: Updated for the above.

* rendering/RenderElement.cpp:
(WebCore::RenderElement::~RenderElement): Use references for the layers.
(WebCore::RenderElement::adjustStyleDifference): Ditto.
(WebCore::RenderElement::updateFillImages): Ditto.
(WebCore::RenderElement::setStyle): Use RenderStyle::replace to replace the
old style with the new style, and get the old one out at the same time.
(WebCore::RenderElement::styleDidChange): Use references for the layers.
(WebCore::mustRepaintFillLayers): Ditto.
(WebCore::RenderElement::repaintAfterLayoutIfNeeded): Ditto.
* rendering/RenderElement.h: Updated for the above.

* rendering/RenderGrid.cpp:
(WebCore::RenderGrid::computeContentPositionAndDistributionOffset):
Refactor so we don't need so many functions in RenderStyle.
* rendering/RenderMenuList.cpp:
(WebCore::RenderMenuList::adjustInnerStyle): Ditto.

* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::createScrollbar): Pass widget as reference to addChild.
Also did a few other tweaks and used more specific types.

* rendering/RenderLayerBacking.cpp:
(WebCore::canCreateTiledImage): Updated since layers are references.
(WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): Ditto.

* rendering/RenderListBox.cpp:
(WebCore::RenderListBox::createScrollbar): Pass widget as reference to addChild.

* rendering/RenderTableCell.cpp:
(WebCore::RenderTableCell::paintBackgroundsBehindCell): Updated to use
references for layers.

* rendering/RenderTheme.cpp:
(WebCore::RenderTheme::adjustStyle): Use WTFMove to pass a LengthBox.
(WebCore::RenderTheme::isControlStyled): Updated since LengthSize is a struct,
more WTFMove, change since layers are ferences.

* rendering/RenderThemeEfl.cpp:
(WebCore::RenderThemeEfl::adjustSizeConstraints): Update for Length and
LengthSize changes.
(WebCore::RenderThemeEfl::paintThemePart): Use reference instead of pointer.
(WebCore::RenderThemeEfl::applyPartDescriptionFallback): Update for Length and
LengthSize changes.
(WebCore::RenderThemeEfl::applyPartDescription): Ditto.
(WebCore::RenderThemeEfl::adjustCheckboxStyle): Ditto.
(WebCore::RenderThemeEfl::adjustRadioStyle): Ditto.

* rendering/RenderThemeGtk.cpp:
(WebCore::borderRadiiFromStyle): Update for Length and LengthSize changes.

* rendering/RenderThemeIOS.mm:
(WebCore::RenderThemeIOS::adjustCheckboxStyle): Update for Length and
LengthSize changes.
(WebCore::RenderThemeIOS::isControlStyled): Ditto.
(WebCore::RenderThemeIOS::adjustRadioStyle): Ditto.
(WebCore::RenderThemeIOS::adjustRoundBorderRadius): Ditto.
(WebCore::RenderThemeIOS::paintMenuListButtonDecorations): Ditto.
(WebCore::RenderThemeIOS::adjustSliderTrackStyle): Ditto.
(WebCore::RenderThemeIOS::adjustSliderThumbSize): Ditto.

* rendering/RenderWidget.cpp:
(WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets): Use move
insteead of swap and modern for loop instead of iterators.
(WebCore::moveWidgetToParentSoon): Take a reference instead of a pointer.
(WebCore::RenderWidget::setWidget): Update for above change.
(WebCore::RenderWidget::find): Take a reference instead of a pointer.
* rendering/RenderWidget.h: Updated for above changes.

* rendering/TextAutoSizing.cpp:
(WebCore::TextAutoSizingValue::reset): Updated since Length is passed as
rvalue reference now.

* rendering/mathml/MathMLStyle.cpp:
(WebCore::MathMLStyle::getMathMLStyle): Updated since mathMLStyle returns
a reference.
(WebCore::MathMLStyle::resolveMathMLStyleTree): Ditto.

* rendering/mathml/RenderMathMLBlock.h:
(WebCore::RenderMathMLBlock::mathMLStyle): Removed no-longer needed const_cast,
changed to return a reference rather than a pointer.
(WebCore::RenderMathMLTable::mathMLStyle): Ditto.

* rendering/mathml/RenderMathMLFraction.cpp:
(WebCore::RenderMathMLFraction::fractionParameters): Updated since mathMLStyle
returns a reference.
(WebCore::RenderMathMLFraction::stackParameters): Ditto.
* rendering/mathml/RenderMathMLOperator.h:
(WebCore::RenderMathMLOperator::isLargeOperatorInDisplayStyle): Ditto.
(WebCore::RenderMathMLOperator::shouldMoveLimits): Ditto.
* rendering/mathml/RenderMathMLRoot.cpp:
(WebCore::RenderMathMLRoot::verticalParameters): Ditto.
* rendering/mathml/RenderMathMLToken.cpp:
(WebCore::RenderMathMLToken::updateMathVariantGlyph): Ditto.

* rendering/style/BasicShapes.cpp:
(WebCore::floatSizeForLengthSize): Updated for LengthSize struct.
* rendering/style/BorderData.h:
(WebCore::BorderData::BorderData): Ditto.
(WebCore::BorderData::hasBorderRadius): Ditto.

* rendering/style/ContentData.cpp:
(WebCore::ContentData::clone): Updated member names.
* rendering/style/ContentData.h: Ditto.

* rendering/style/NinePieceImage.cpp:
(WebCore::NinePieceImage::computeSlices): Use initializer lists so we get
move optimization without requiring explicit WTFMove.

* rendering/style/DataRef.h:
(WebCore::DataRef::DataRef): Removed no-longer needed const_cast.
(WebCore::DataRef::replace): Added. This function is like Ref::replace, and
can be used to put a new value in and get an old value out without running into
the rule Ref has about not being reused once it becomes null because of being
moved out of. This function is a lot like std::exchange.
(WebCore::DataRef::operator const T&): Added operator so we can use these
as references without any function call in read-only contexts.
(WebCore::DataRef::get): Changed to return a reference rather than pointer.
(WebCore::DataRef::access): Ditto.

* rendering/style/KeyframeList.cpp:
(WebCore::KeyframeValue::timingFunction): Updated since timingFunction
returns a raw pointer.
(WebCore::KeyframeList::~KeyframeList): Removed unneeded call to clear,
which does things that are redundant since we are about to destroy all the
data members.
(WebCore::KeyframeList::operator==): Tweaked codign style a bit.

* rendering/style/NinePieceImage.h: Updated most functions in this class
for the changes to DataRef.

* rendering/style/RenderStyle.cpp: Updated nearly every function in this
class for the changes to DataRef, to eliminate the peculiar naming and use
our standard data member naming, m_memberName in a class, and memberName in a
struct or struct-like class for publicly accessible members, to pass, take,
and return more references and rvalue references, and to use modern for loops.
Other changes listed below function by function.
(WebCore::RenderStyle::defaultStyle): Use NeverDestroyed instead of allocating
on the heap.
(WebCore::RenderStyle::RenderStyle): Added a new constructor that performs
the replace operation, using a combination of DataRef::replace and std::exchange.
(WebCore::RenderStyle::replace): Added. Calls the above constructor.
(WebCore::RenderStyle::setScrollSnapType): Use SET_NESTED_VAR so we get equality
checks on this property, for the normal efficiency benefit.
(WebCore::RenderStyle::setDashboardRegion): Moved this here from the header.
(WebCore::RenderStyle::appendContent): Deleted.
(WebCore::RenderStyle::setContent): Refactored this set of functions to simplify.

* rendering/style/RenderStyle.h: Updated most functions as mentioned above.
Also updated macros to use the do/while(0) technique. Removed the long list of
friend classes with the elaborate comments; turned out none needed friendship
despite the comments. Made more things private. Moved large functions out of the
class definition.
(WebCore::RenderStyle::getTextShadowExtent): Deleted.
(WebCore::RenderStyle::getTextShadowHorizontalExtent): Deleted.
(WebCore::RenderStyle::getTextShadowVerticalExtent): Deleted.
(WebCore::RenderStyle::aspectRatio): Deleted.
(WebCore::RenderStyle::alignContentPosition): Deleted.
(WebCore::RenderStyle::alignContentDistribution): Deleted.
(WebCore::RenderStyle::alignContentOverflowAlignment): Deleted.
(WebCore::RenderStyle::alignItemsPosition): Deleted.
(WebCore::RenderStyle::alignItemsOverflowAlignment): Deleted.
(WebCore::RenderStyle::alignSelfPosition): Deleted.
(WebCore::RenderStyle::alignSelfOverflowAlignment): Deleted.
(WebCore::RenderStyle::justifyContentPosition): Deleted.
(WebCore::RenderStyle::justifyContentDistribution): Deleted.
(WebCore::RenderStyle::justifyContentOverflowAlignment): Deleted.
(WebCore::RenderStyle::justifyItemsPosition): Deleted.
(WebCore::RenderStyle::justifyItemsOverflowAlignment): Deleted.
(WebCore::RenderStyle::justifyItemsPositionType): Deleted.
(WebCore::RenderStyle::justifySelfPosition): Deleted.
(WebCore::RenderStyle::justifySelfOverflowAlignment): Deleted.
(WebCore::RenderStyle::setAlignContentPosition): Deleted.
(WebCore::RenderStyle::setAlignContentOverflow): Deleted.
(WebCore::RenderStyle::setAlignContentDistribution): Deleted.
(WebCore::RenderStyle::setAlignItemsOverflow): Deleted.
(WebCore::RenderStyle::setAlignSelfOverflow): Deleted.
(WebCore::RenderStyle::setJustifyContentOverflow): Deleted.
(WebCore::RenderStyle::setJustifyContentDistribution): Deleted.
(WebCore::RenderStyle::setJustifyItemsPosition): Deleted.
(WebCore::RenderStyle::setJustifyItemsOverflow): Deleted.
(WebCore::RenderStyle::setJustifyItemsPositionType): Deleted.
(WebCore::RenderStyle::setJustifySelfPosition): Deleted.
(WebCore::RenderStyle::setJustifySelfOverflow): Deleted.
(WebCore::RenderStyle::noninheritedFlagsMemoryOffset): Deleted.

* rendering/style/SVGRenderStyle.cpp: Similar changes to RenderStyle.cpp above.
* rendering/style/SVGRenderStyle.h: Ditto.

* rendering/style/ShapeValue.h:
(WebCore::ShapeValue::create): Take a Ref&& instead of a RefPtr.
(WebCore::ShapeValue::ShapeValue): Ditto.

* rendering/style/StyleBackgroundData.cpp: Update data member names.
* rendering/style/StyleBackgroundData.h: Ditto; make them public and remove the
getter functions.

* rendering/style/StyleCachedImage.cpp:
(WebCore::StyleCachedImage::cssValue): Removed no-longer-needed const_cast.

* rendering/style/StyleCustomPropertyData.h: Update data member names.
(WebCore::StyleCustomPropertyData::operator==): Removed unnecessary reference
count churn.
(WebCore::StyleCustomPropertyData::setCustomPropertyValue): Take an rvalue
reference.
(WebCore::StyleCustomPropertyData::getCustomPropertyValue): Deleted.
(WebCore::StyleCustomPropertyData::values): Deleted.
(WebCore::StyleCustomPropertyData::hasCustomProperty): Deleted.
(WebCore::StyleCustomPropertyData::containsVariables): Deleted.
(WebCore::StyleCustomPropertyData::setContainsVariables): Deleted.

* rendering/style/StyleFilterData.cpp: Update data member names.
* rendering/style/StyleFilterData.h: Ditto.
* rendering/style/StyleFlexibleBoxData.cpp: Ditto.
* rendering/style/StyleFlexibleBoxData.h: Ditto.
* rendering/style/StyleGridData.cpp: Ditto.
* rendering/style/StyleGridData.h: Ditto.
* rendering/style/StyleGridItemData.cpp: Ditto.
* rendering/style/StyleGridItemData.h: Ditto.

* rendering/style/StyleGeneratedImage.cpp:
(WebCore::StyleGeneratedImage::cssValue): Removed no-longer-needed const_cast.
(WebCore::StyleGeneratedImage::imageSize): Ditto.
(WebCore::StyleGeneratedImage::image): Ditto.

* rendering/style/StyleInheritedData.cpp: Update data member names.
* rendering/style/StyleInheritedData.h: Ditto.
* rendering/style/StyleRareInheritedData.cpp: Ditto.
* rendering/style/StyleRareInheritedData.h: Ditto.
* rendering/style/StyleMultiColData.cpp: Ditto.
* rendering/style/StyleMultiColData.h: Ditto.
* rendering/style/StyleRareNonInheritedData.cpp: Ditto.
* rendering/style/StyleRareNonInheritedData.h: Ditto.
* rendering/style/StyleTransformData.cpp: Ditto.
* rendering/style/StyleTransformData.h: Ditto.
* rendering/style/StyleVisualData.cpp: Ditto.
* rendering/style/StyleVisualData.h: Ditto.

* style/StylePendingResources.cpp:
(WebCore::Style::loadPendingResources): Update since layers are references.

Source/WebKit/mac:

* WebCoreSupport/WebFrameLoaderClient.mm:
(NetscapePluginWidget::handleEvent): Pass a reference.
* WebView/WebView.mm:
(-[WebView _addScrollerDashboardRegionsForFrameView:dashboardRegions:]):
Updated since the children set now contains Ref instead of RefPtr.

Source/WebKit2:

* Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp:
(IPC::ArgumentCoder<TextureMapperAnimation>::encode): Updated since timing function
returns a raw pointer.
(IPC::ArgumentCoder<TextureMapperAnimation>::decode): Updated since timing function
setters now takes an rvalue reference.

* WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm:
(WebKit::PDFPlugin::createScrollbar): Updated since addChild now takes a reference.

Source/WTF:

* wtf/Ref.h: Changed the template so that a const Ref<T> does not prohibit non-const
use of T. We can still use const Ref<const T> to express that. The earlier design
was intentional, but was not consistent with either actual references or with
other smart pointer classes like RefPtr. One way to see how much better this is,
is to see all the many, many cases where we have const_cast just to work around
this. I searched for those and included fixes for many in this patch.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@210758 268f45cc-cd09-0410-ab3c-d52691b4dbfc

169 files changed:
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/inspector/JSInjectedScriptHost.h
Source/JavaScriptCore/runtime/PrivateName.h
Source/WTF/ChangeLog
Source/WTF/wtf/Ref.h
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.h
Source/WebCore/Modules/speech/SpeechSynthesisUtterance.cpp
Source/WebCore/Modules/speech/SpeechSynthesisUtterance.h
Source/WebCore/bindings/js/JSDOMConvert.h
Source/WebCore/bindings/js/JSDOMWrapper.h
Source/WebCore/bindings/js/ScriptModuleLoader.cpp
Source/WebCore/css/BasicShapeFunctions.cpp
Source/WebCore/css/CSSComputedStyleDeclaration.cpp
Source/WebCore/css/CSSImageGeneratorValue.cpp
Source/WebCore/css/CSSKeyframesRule.cpp
Source/WebCore/css/CSSPrimitiveValue.cpp
Source/WebCore/css/CSSStyleRule.h
Source/WebCore/css/CSSToStyleMap.cpp
Source/WebCore/css/FontFace.cpp
Source/WebCore/css/LengthFunctions.cpp
Source/WebCore/css/LengthFunctions.h
Source/WebCore/css/SVGCSSComputedStyleDeclaration.cpp
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/StyleBuilderCustom.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/makeprop.pl
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/EventPath.cpp
Source/WebCore/dom/LiveNodeList.h
Source/WebCore/dom/MessageEvent.cpp
Source/WebCore/dom/Node.cpp
Source/WebCore/dom/Range.h
Source/WebCore/dom/RegisteredEventListener.h
Source/WebCore/dom/ScriptRunner.cpp
Source/WebCore/html/HTMLCollection.h
Source/WebCore/html/parser/HTMLStackItem.h
Source/WebCore/inspector/PageScriptDebugServer.cpp
Source/WebCore/inspector/PageScriptDebugServer.h
Source/WebCore/loader/HistoryController.cpp
Source/WebCore/page/Frame.cpp
Source/WebCore/page/Frame.h
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/Page.cpp
Source/WebCore/page/PrintContext.cpp
Source/WebCore/page/animation/AnimationBase.cpp
Source/WebCore/page/animation/CSSPropertyAnimation.cpp
Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
Source/WebCore/platform/KeyedCoding.h
Source/WebCore/platform/LengthBox.h
Source/WebCore/platform/LengthSize.cpp
Source/WebCore/platform/LengthSize.h
Source/WebCore/platform/PlatformSpeechSynthesis.h [deleted file]
Source/WebCore/platform/PlatformSpeechSynthesisUtterance.cpp
Source/WebCore/platform/PlatformSpeechSynthesisUtterance.h
Source/WebCore/platform/PlatformSpeechSynthesisVoice.cpp
Source/WebCore/platform/PlatformSpeechSynthesisVoice.h
Source/WebCore/platform/ScrollView.cpp
Source/WebCore/platform/ScrollView.h
Source/WebCore/platform/Theme.h
Source/WebCore/platform/animation/Animation.h
Source/WebCore/platform/animation/AnimationList.cpp
Source/WebCore/platform/animation/AnimationList.h
Source/WebCore/platform/animation/AnimationTrigger.h
Source/WebCore/platform/animation/TimingFunction.h
Source/WebCore/platform/audio/AudioBus.h
Source/WebCore/platform/cf/KeyedEncoderCF.cpp
Source/WebCore/platform/cf/KeyedEncoderCF.h
Source/WebCore/platform/efl/PlatformSpeechSynthesisProviderEfl.h
Source/WebCore/platform/glib/KeyedEncoderGlib.cpp
Source/WebCore/platform/glib/KeyedEncoderGlib.h
Source/WebCore/platform/graphics/FontCache.h
Source/WebCore/platform/graphics/FontPlatformData.h
Source/WebCore/platform/graphics/GraphicsLayer.h
Source/WebCore/platform/graphics/LegacyCDMSession.h
Source/WebCore/platform/graphics/PathUtilities.cpp
Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp
Source/WebCore/platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h
Source/WebCore/platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp
Source/WebCore/platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
Source/WebCore/platform/graphics/filters/FilterOperations.cpp
Source/WebCore/platform/graphics/filters/FilterOperations.h
Source/WebCore/platform/graphics/texmap/TextureMapperAnimation.cpp
Source/WebCore/platform/ios/PlatformSpeechSynthesizerIOS.mm
Source/WebCore/platform/mac/ThemeMac.mm
Source/WebCore/platform/mac/WidgetMac.mm
Source/WebCore/platform/mock/DeviceMotionClientMock.cpp [deleted file]
Source/WebCore/platform/mock/DeviceMotionClientMock.h [deleted file]
Source/WebCore/platform/win/CursorWin.cpp
Source/WebCore/rendering/FilterEffectRenderer.cpp
Source/WebCore/rendering/ImageQualityController.cpp
Source/WebCore/rendering/InlineFlowBox.cpp
Source/WebCore/rendering/InlineFlowBox.h
Source/WebCore/rendering/RenderBox.cpp
Source/WebCore/rendering/RenderBox.h
Source/WebCore/rendering/RenderBoxModelObject.cpp
Source/WebCore/rendering/RenderBoxModelObject.h
Source/WebCore/rendering/RenderElement.cpp
Source/WebCore/rendering/RenderElement.h
Source/WebCore/rendering/RenderGrid.cpp
Source/WebCore/rendering/RenderLayer.cpp
Source/WebCore/rendering/RenderLayerBacking.cpp
Source/WebCore/rendering/RenderListBox.cpp
Source/WebCore/rendering/RenderMenuList.cpp
Source/WebCore/rendering/RenderTableCell.cpp
Source/WebCore/rendering/RenderTheme.cpp
Source/WebCore/rendering/RenderThemeEfl.cpp
Source/WebCore/rendering/RenderThemeGtk.cpp
Source/WebCore/rendering/RenderThemeIOS.mm
Source/WebCore/rendering/RenderWidget.cpp
Source/WebCore/rendering/RenderWidget.h
Source/WebCore/rendering/TextAutoSizing.cpp
Source/WebCore/rendering/mathml/MathMLStyle.cpp
Source/WebCore/rendering/mathml/RenderMathMLBlock.h
Source/WebCore/rendering/mathml/RenderMathMLFraction.cpp
Source/WebCore/rendering/mathml/RenderMathMLOperator.h
Source/WebCore/rendering/mathml/RenderMathMLRoot.cpp
Source/WebCore/rendering/mathml/RenderMathMLToken.cpp
Source/WebCore/rendering/style/BasicShapes.cpp
Source/WebCore/rendering/style/BorderData.h
Source/WebCore/rendering/style/ContentData.cpp
Source/WebCore/rendering/style/ContentData.h
Source/WebCore/rendering/style/DataRef.h
Source/WebCore/rendering/style/KeyframeList.cpp
Source/WebCore/rendering/style/NinePieceImage.cpp
Source/WebCore/rendering/style/NinePieceImage.h
Source/WebCore/rendering/style/RenderStyle.cpp
Source/WebCore/rendering/style/RenderStyle.h
Source/WebCore/rendering/style/SVGRenderStyle.cpp
Source/WebCore/rendering/style/SVGRenderStyle.h
Source/WebCore/rendering/style/ShapeValue.h
Source/WebCore/rendering/style/StyleBackgroundData.cpp
Source/WebCore/rendering/style/StyleBackgroundData.h
Source/WebCore/rendering/style/StyleCachedImage.cpp
Source/WebCore/rendering/style/StyleCustomPropertyData.h
Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.cpp
Source/WebCore/rendering/style/StyleDeprecatedFlexibleBoxData.h
Source/WebCore/rendering/style/StyleFilterData.cpp
Source/WebCore/rendering/style/StyleFilterData.h
Source/WebCore/rendering/style/StyleFlexibleBoxData.cpp
Source/WebCore/rendering/style/StyleFlexibleBoxData.h
Source/WebCore/rendering/style/StyleGeneratedImage.cpp
Source/WebCore/rendering/style/StyleGridData.cpp
Source/WebCore/rendering/style/StyleGridData.h
Source/WebCore/rendering/style/StyleGridItemData.cpp
Source/WebCore/rendering/style/StyleGridItemData.h
Source/WebCore/rendering/style/StyleInheritedData.cpp
Source/WebCore/rendering/style/StyleInheritedData.h
Source/WebCore/rendering/style/StyleMultiColData.cpp
Source/WebCore/rendering/style/StyleMultiColData.h
Source/WebCore/rendering/style/StyleRareInheritedData.cpp
Source/WebCore/rendering/style/StyleRareInheritedData.h
Source/WebCore/rendering/style/StyleRareNonInheritedData.cpp
Source/WebCore/rendering/style/StyleRareNonInheritedData.h
Source/WebCore/rendering/style/StyleTransformData.cpp
Source/WebCore/rendering/style/StyleTransformData.h
Source/WebCore/rendering/style/StyleVisualData.cpp
Source/WebCore/rendering/style/StyleVisualData.h
Source/WebCore/style/StylePendingResources.cpp
Source/WebKit/mac/ChangeLog
Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
Source/WebKit/mac/WebView/WebView.mm
Source/WebKit2/ChangeLog
Source/WebKit2/Shared/CoordinatedGraphics/CoordinatedGraphicsArgumentCoders.cpp
Source/WebKit2/WebProcess/Plugins/PDF/DeprecatedPDFPlugin.mm

index e824299..5508ab2 100644 (file)
@@ -1,3 +1,16 @@
+2017-01-11  Darin Adler  <darin@apple.com>
+
+        Remove PassRefPtr from more of "platform"
+        https://bugs.webkit.org/show_bug.cgi?id=166809
+
+        Reviewed by Sam Weinig.
+
+        * inspector/JSInjectedScriptHost.h:
+        (Inspector::JSInjectedScriptHost::impl): Simplified code since we don't need a
+        const_cast here any more.
+        * runtime/PrivateName.h:
+        (JSC::PrivateName::uid): Ditto.
+
 2017-01-13  Ryan Haddad  <ryanhaddad@apple.com>
 
         Unreviewed, rolling out r210735.
index 1bd4d77..ede7543 100644 (file)
@@ -53,7 +53,7 @@ public:
     static JSC::JSObject* createPrototype(JSC::VM&, JSC::JSGlobalObject*);
     static void destroy(JSC::JSCell*);
 
-    InjectedScriptHost& impl() const { return const_cast<InjectedScriptHost&>(m_wrapped.get()); }
+    InjectedScriptHost& impl() const { return m_wrapped; }
 
     // Attributes.
     JSC::JSValue evaluate(JSC::ExecState*) const;
index 4b86dec..ea43ff1 100644 (file)
@@ -54,7 +54,7 @@ public:
 
     PrivateName(PrivateName&&) = default;
 
-    SymbolImpl& uid() const { return const_cast<SymbolImpl&>(m_uid.get()); }
+    SymbolImpl& uid() const { return m_uid; }
 
     bool operator==(const PrivateName& other) const { return &uid() == &other.uid(); }
     bool operator!=(const PrivateName& other) const { return &uid() != &other.uid(); }
index 9aac4e6..c4cb32e 100644 (file)
@@ -1,3 +1,17 @@
+2017-01-11  Darin Adler  <darin@apple.com>
+
+        Remove PassRefPtr from more of "platform"
+        https://bugs.webkit.org/show_bug.cgi?id=166809
+
+        Reviewed by Sam Weinig.
+
+        * wtf/Ref.h: Changed the template so that a const Ref<T> does not prohibit non-const
+        use of T. We can still use const Ref<const T> to express that. The earlier design
+        was intentional, but was not consistent with either actual references or with
+        other smart pointer classes like RefPtr. One way to see how much better this is,
+        is to see all the many, many cases where we have const_cast just to work around
+        this. I searched for those and included fixes for many in this patch.
+
 2017-01-12  Chris Dumez  <cdumez@apple.com>
 
         [iOS] Implement support for KeyboardEvent.code
index 47e5fa0..e955352 100644 (file)
@@ -133,17 +133,10 @@ public:
         ASSERT(m_ptr);
     }
 
-    const T* operator->() const { ASSERT(m_ptr); return m_ptr; }
-    T* operator->() { ASSERT(m_ptr); return m_ptr; }
-
-    const T* ptr() const { ASSERT(m_ptr); return m_ptr; }
-    T* ptr() { ASSERT(m_ptr); return m_ptr; }
-
-    const T& get() const { ASSERT(m_ptr); return *m_ptr; }
-    T& get() { ASSERT(m_ptr); return *m_ptr; }
-
-    operator T&() { ASSERT(m_ptr); return *m_ptr; }
-    operator const T&() const { ASSERT(m_ptr); return *m_ptr; }
+    T* operator->() const { ASSERT(m_ptr); return m_ptr; }
+    T* ptr() const { ASSERT(m_ptr); return m_ptr; }
+    T& get() const { ASSERT(m_ptr); return *m_ptr; }
+    operator T&() const { ASSERT(m_ptr); return *m_ptr; }
 
     template<typename U> Ref<T> replace(Ref<U>&&) WARN_UNUSED_RETURN;
 
index f56d746..aca870f 100644 (file)
@@ -2271,7 +2271,6 @@ set(WebCore_SOURCES
     platform/mediastream/RealtimeMediaSourceSettings.cpp
     platform/mediastream/SDPProcessorScriptResource.cpp
 
-    platform/mock/DeviceMotionClientMock.cpp
     platform/mock/DeviceOrientationClientMock.cpp
     platform/mock/GeolocationClientMock.cpp
     platform/mock/MockMediaEndpoint.cpp
index 6848066..36c5660 100644 (file)
@@ -1,3 +1,645 @@
+2017-01-11  Darin Adler  <darin@apple.com>
+
+        Remove PassRefPtr from more of "platform"
+        https://bugs.webkit.org/show_bug.cgi?id=166809
+
+        Reviewed by Sam Weinig.
+
+        * CMakeLists.txt: Removed DeviceMotionClientMock.cpp.
+
+        * Modules/encryptedmedia/legacy/LegacyCDMSessionClearKey.h:
+        Added now-needed include.
+
+        * Modules/speech/SpeechSynthesisUtterance.cpp:
+        (WebCore::SpeechSynthesisUtterance::SpeechSynthesisUtterance):
+        Pass a reference instead of a pointer.
+
+        * Modules/speech/SpeechSynthesisUtterance.h: Tweaks, msade a few things
+        more private and final.
+
+        * bindings/js/JSDOMConvert.h:
+        (WebCore::Detail::getPtrOrRef): Removed no-longer-needed const_cast.
+        * bindings/js/JSDOMWrapper.h:
+        (WebCore::JSDOMWrapper::wrapped): Ditto.
+        * bindings/js/ScriptModuleLoader.cpp:
+        (WebCore::ScriptModuleLoader::~ScriptModuleLoader): Ditto.
+
+        * css/BasicShapeFunctions.cpp:
+        (WebCore::convertToLengthSize): Updated for LengthSize struct.
+        (WebCore::convertToCenterCoordinate): Ditto.
+
+        * css/CSSComputedStyleDeclaration.cpp:
+        (WebCore::createPositionListForLayer): Take a reference.
+        (WebCore::getBorderRadiusCornerValues): Updated for LengthSize struct.
+        (WebCore::getBorderRadiusCornerValue): Ditto.
+        (WebCore::getBorderRadiusShorthandValue): Ditto.
+        (WebCore::fillSizeToCSSValue): Ditto.
+        (WebCore::ComputedStyleExtractor::propertyValue): Updated many properties
+        since the layer properties now return references rather than pointers.
+
+        * css/CSSImageGeneratorValue.cpp:
+        (WebCore::CSSImageGeneratorValue::CachedGeneratedImage::image): Removed
+        no-longer-needed const_cast.
+        * css/CSSKeyframesRule.cpp:
+        (WebCore::CSSKeyframesRule::item): Ditto.
+
+        * css/CSSPrimitiveValue.cpp:
+        (WebCore::CSSPrimitiveValue::init): Updated for LengthSize struct.
+
+        * css/CSSStyleRule.h: Removed no-longer-needed const_cast.
+
+        * css/CSSToStyleMap.cpp:
+        (WebCore::convertToLengthSize): Updated for LengthSize struct.
+
+        * css/FontFace.cpp:
+        (WebCore::FontFace::family): Removed no-longer-needed const_cast.
+        (WebCore::FontFace::style): Ditto.
+        (WebCore::FontFace::weight): Ditto.
+        (WebCore::FontFace::unicodeRange): Ditto.
+        (WebCore::FontFace::variant): Ditto.
+        (WebCore::FontFace::featureSettings): Ditto.
+
+        * css/LengthFunctions.cpp:
+        (WebCore::sizeForLengthSize): Added.
+        (WebCore::floatSizeForLengthSize): Updated for LengthSize struct.
+        * css/LengthFunctions.h: Added sizeForLengthSize.
+
+        * css/SVGCSSComputedStyleDeclaration.cpp:
+        (WebCore::paintOrder): Cut down on creation of unused objects.
+        We now create only what we actually use.
+
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertRadius): Updated for
+        LengthSize struct.
+        (WebCore::StyleBuilderConverter::convertShapeValue): Pass references
+        when creating ShapeValue.
+
+        * css/StyleBuilderCustom.h:
+        (WebCore::forwardInheritedValue): Added. This set of overloaded
+        functions allows us to use move semantics for some types, but copy
+        them when inheriting. Doing it with special cases here allows us to
+        resolve this without adding overloads someone might be tempted to
+        call outside the style builder, and without adding special cases to
+        the JSON file for each property.
+        (WebCore::StyleBuilderCustom::applyValueWebkitDashboardRegion):
+        Add WTFMove as needed to work with rvalue references.
+        (WebCore::StyleBuilderCustom::applyValueSize): Ditto.
+        (WebCore::StyleBuilderCustom::applyInheritTextIndent): Ditto.
+        (WebCore::StyleBuilderCustom::applyValueTextIndent): Ditto.
+        (WebCore::StyleBuilderCustom::applyInheritLineHeight): Ditto.
+        (WebCore::StyleBuilderCustom::applyValueLineHeight): Ditto.
+        (WebCore::StyleBuilderCustom::applyInheritClip): Ditto.
+        (WebCore::StyleBuilderCustom::applyValueClip): Ditto.
+
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::State::cacheBorderAndBackground): Use
+        references instead of pointers.
+        (WebCore::StyleResolver::applyMatchedProperties): Ditto.
+        (WebCore::StyleResolver::applyProperty): Update for changes to the
+        custom property data in RenderStyle.
+
+        * css/makeprop.pl: Use auto quite a bit more in the generated code.
+        Updated special cases for layers to expect references. Added a WTFMove
+        so we can get move semantics for converted values that come out in
+        an optional. Added call to forwardInheritedValue (see above).
+
+        * dom/Document.cpp:
+        (WebCore::Document::pageSizeAndMarginsInPixels): Use auto and update
+        since LengthSize is a struct.
+
+        * dom/EventPath.cpp:
+        (WebCore::EventPath::computePathUnclosedToTarget): Use auto.
+
+        * dom/LiveNodeList.h:
+        (WebCore::LiveNodeList::ownerNode): Removed no-longer-needed const_cast.
+
+        * dom/MessageEvent.cpp:
+        (WebCore::MessageEvent::source): Removed unneeded static_cast.
+
+        * dom/Node.cpp:
+        (WebCore::nodeSetPreTransformedFromNodeOrStringVector): Tweaked formatting.
+
+        * dom/Range.h:
+        (WebCore::Range::ownerDocument): Removed no-longer-needed const_cast.
+        * dom/RegisteredEventListener.h:
+        (WebCore::RegisteredEventListener::callback): Ditto.
+        * dom/ScriptRunner.cpp:
+        (WebCore::ScriptRunner::~ScriptRunner): Ditto.
+        * html/HTMLCollection.h:
+        (WebCore::HTMLCollection::ownerNode): Ditto.
+        * html/parser/HTMLStackItem.h:
+        (WebCore::HTMLStackItem::node): Ditto.
+
+        * inspector/PageScriptDebugServer.cpp:
+        (WebCore::PageScriptDebugServer::setJavaScriptPaused): Cut down on the number
+        of different functions here. Also use reference rather than pointer.
+        * inspector/PageScriptDebugServer.h: Updated for above change.
+
+        * loader/HistoryController.cpp:
+        (WebCore::HistoryController::recursiveSetProvisionalItem): Removed
+        no-longer-needed const_cast.
+        (WebCore::HistoryController::recursiveGoToItem): Ditto.
+
+        * page/Frame.cpp:
+        (WebCore::Frame::ownerRenderer): Use auto. Let the is<> function do null
+        checking for us.
+        (WebCore::Frame::frameForWidget): Take a reference rather than a pointer.
+        * page/Frame.h: Updated for the above.
+
+        * page/FrameView.cpp:
+        (WebCore::FrameView::invalidateRect): Use Chrome directly instead of using
+        HostWindow. HostWindow is an abstraction for the platform layer, and there
+        is no good reason to use it here.
+        (WebCore::FrameView::scheduleAnimation): Ditto.
+        (WebCore::FrameView::graphicsLayerForPlatformWidget): Updated to use reference
+        when calling RenderWidget::find.
+        (WebCore::FrameView::scrollContentsFastPath): Use Chrome instead of HostWindow.
+        (WebCore::FrameView::hostWindow): Use early return.
+        (WebCore::FrameView::updateScrollCorner): Removed unneeded call through to base
+        class function, which was empty.
+        (WebCore::FrameView::hasCustomScrollbars): Updated since the children set now
+        contains Ref rather than RefPtr.
+        (WebCore::FrameView::parentFrameView): Use early return.
+        (WebCore::FrameView::updateWidgetPositions): Use reference instead of pointer.
+        * page/FrameView.h: Use final instead of override. Remove now-unneeded const_cast.
+
+        * page/Page.cpp:
+        (WebCore::Page::pluginViews): Updated since the children set now contains
+        Ref rather than RefPtr.
+
+        * page/PrintContext.cpp:
+        (WebCore::PrintContext::pageProperty): Updated for LengthSize struct.
+
+        * page/animation/AnimationBase.cpp:
+        (WebCore::AnimationBase::fireAnimationEventsIfNeeded): Updated for changes to
+        the types in animation function members.
+        (WebCore::AnimationBase::timeToNextService): Ditto.
+        (WebCore::AnimationBase::progress): Ditto.
+        (WebCore::AnimationBase::getElapsedTime): Ditto.
+
+        * page/animation/CSSPropertyAnimation.cpp:
+        (WebCore::blendFunc): Updated for LengthSize struct.
+        (WebCore::LengthPropertyWrapper::LengthPropertyWrapper): Updated since we now
+        use rvalue references and move semantics when setting length properties.
+
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::absoluteEventTrackingRegionsForFrame): Tweaked to
+        use auto, pass references.
+
+        * platform/KeyedCoding.h: Return RefPtr instead of PassRefPtr.
+
+        * platform/LengthBox.h: Added a constructor that moves the lengths in, rather
+        than always copying them.
+
+        * platform/LengthSize.cpp:
+        (WebCore::operator<<): Updated since LengthSize is a struct.
+        * platform/LengthSize.h: Turned LengthSize into a struct and removed all the
+        getter and setter code.
+
+        * platform/PlatformSpeechSynthesis.h: Removed. Unused.
+
+        * platform/PlatformSpeechSynthesisUtterance.cpp:
+        (WebCore::PlatformSpeechSynthesisUtterance::create): Return Ref rather than PassRefPtr.
+        (WebCore::PlatformSpeechSynthesisUtterance::PlatformSpeechSynthesisUtterance): Take
+        a reference. Initialize data members in class definition.
+        * platform/PlatformSpeechSynthesisUtterance.h: Updated for the above.
+
+        * platform/PlatformSpeechSynthesisVoice.cpp:
+        (WebCore::PlatformSpeechSynthesisVoice::create): Return Ref rather than PassRefPtr.
+        * platform/PlatformSpeechSynthesisVoice.h: Updated for the above.
+
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::addChild): Take a reference rather than a PassRefPtr.
+        (WebCore::ScrollView::setHasScrollbarInternal): Updated for change to addChild
+        (WebCore::ScrollView::scrollContentsFastPath): Deleted. This was never called,
+        so made it pure virtual.
+        (WebCore::ScrollView::frameRectsChanged): Use a modern for loop.
+        (WebCore::ScrollView::clipRectChanged): Ditto.
+        (WebCore::ScrollView::updateScrollCorner): Deleted. This was empty so made it pure
+        virtual and changed FrameView to not call it.
+        (WebCore::ScrollView::setParentVisible): Use a modern for loop.
+        (WebCore::ScrollView::show): Ditto.
+        (WebCore::ScrollView::hide): Ditto.
+        * platform/ScrollView.h: Changed the children set to contain Ref instead of RefPtr.
+        Changed functions that were never overridden to either be final or non-virtual,
+        Changed functions that were never called to be pure virtual.
+
+        * platform/Theme.h:
+        (WebCore::Theme::minimumControlSize): Updated for LengthSize struct.
+
+        * platform/animation/Animation.h: Changed timingFunction and trigger to return
+        raw pointers instead of PassRefPtr. Changed setTimingFunction and setTrigger to
+        take RefPtr&& and Ref&& instead of PassRefPtr. CHanged initialTimingfunction and
+        initialTrigger to return Ref.
+
+        * platform/animation/AnimationList.cpp: Removed redundant check in FILL_UNSET_PROPERTY.
+        (WebCore::AnimationList::AnimationList): Use modern for loop, reserveInitialCapacity,
+        and uncheckedAppend.
+        * platform/animation/AnimationList.h: Changed append to take Ref&& instead of PassRefPtr.
+        changed vecto to contain Ref instead of RefPtr. Added move constructor and assignment
+        operator.
+
+        * platform/animation/AnimationTrigger.h:
+        (WebCore::AutoAnimationTrigger::clone): Return Ref instead of PassRefPtr.
+        (WebCore::AutoAnimationTrigger::create): Ditto.
+        (WebCore::AutoAnimationTrigger::clone): Ditto.
+        (WebCore::ScrollAnimationTrigger::create): Ditto.
+        (WebCore::ScrollAnimationTrigger::clone): Ditto.
+
+        * platform/animation/TimingFunction.h:
+        (WebCore::LinearTimingFunction::create): Return Ref instead of PassRefPtr.
+        (WebCore::CubicBezierTimingFunction::create): Ditto.
+        (WebCore::CubicBezierTimingFunction::defaultTimingFunction): Return a reference
+        instead of a pointer.
+        (WebCore::CubicBezierTimingFunction::createReversed): Return Ref instead of PassRefPtr.
+        (WebCore::CubicBezierTimingFunction::clone): Ditto.
+        (WebCore::StepsTimingFunction::create): Ditto.
+        (WebCore::StepsTimingFunction::clone): Ditto.
+        (WebCore::SpringTimingFunction::create): Ditto.
+        (WebCore::SpringTimingFunction::clone): Ditto.
+
+        * platform/audio/AudioBus.h:
+        (WebCore::AudioBus::channel): Removed no-longer-needed const_cast.
+
+        * platform/cf/KeyedEncoderCF.cpp:
+        (WebCore::KeyedEncoderCF::finishEncoding): Return RefPtr instead of PassRefPtr.
+        * platform/cf/KeyedEncoderCF.h: Use final instead of override. Made even more
+        private. Changed return value of finishEncoding to Ref instead of PassRefPtr.
+
+        * platform/efl/PlatformSpeechSynthesisProviderEfl.h: Removed include of PassRefPtr.h.
+
+        * platform/glib/KeyedEncoderGlib.cpp:
+        (WebCore::KeyedEncoderGlib::finishEncoding): Return RefPtr instead of PassRefPtr.
+        * platform/glib/KeyedEncoderGlib.h: Use final instead of override. Made even more
+        private. Changed return value of finishEncoding to Ref instead of PassRefPtr.
+
+        * platform/graphics/filters/FilterOperations.cpp:
+        (WebCore::outsetSizeForBlur): Simplified, removing unnecessary floating point math.
+        (WebCore::FilterOperations::FilterOperations): Deleted. Let the compiler generate this.
+        (WebCore::FilterOperations::operator=): Deleted. Let the compiler generate this.
+        (WebCore::FilterOperations::operator==): Streamlined.
+        (WebCore::FilterOperations::operationsMatch): Ditto.
+        (WebCore::FilterOperations::hasReferenceFilter): Ditto.
+        (WebCore::FilterOperations::hasOutsets): Ditto.
+        (WebCore::FilterOperations::outsets): Ditto.
+        (WebCore::FilterOperations::hasFilterThatAffectsOpacity): Ditto.
+        (WebCore::FilterOperations::hasFilterThatMovesPixels): Ditto.
+        * platform/graphics/filters/FilterOperations.h: Updated for above changes.
+
+        * platform/graphics/FontCache.h: Removed included of PassRefPtr.h.
+
+        * platform/graphics/FontPlatformData.h: Tweaked formatting. Removed nesting
+        from #if since our formatting makes it hard to see nesting. Let the compiler
+        generate the default move and copy constructors and assignemnt operators except
+        in the USE(FREETYPE) case.
+
+        * platform/graphics/GraphicsLayer.h:
+        (WebCore::AnimationValue::AnimationValue): Updated since clone now returns a Ref
+        rather than a RefPtr.
+        (WebCore::FloatAnimationValue::FloatAnimationValue): Deleted. Let the compiler
+        generate the copy constructor without defining it explicitly.
+        (WebCore::TransformAnimationValue::TransformAnimationValue): Use a modern for
+        loop, reserveInitialCapacity, and unchecked append. Also tell the compiler to
+        generate the move constructor, since the special work is only needed for the
+        copy constructor.
+        (WebCore::FilterAnimationValue::FilterAnimationValue): Ditto.
+        (WebCore::KeyframeValueList::KeyframeValueList): Ditto.
+
+        * platform/graphics/LegacyCDMSession.h: Removed include of PassRefPtr.h.
+
+        * platform/graphics/PathUtilities.cpp:
+        (WebCore::PathUtilities::pathWithShrinkWrappedRectsForOutline): Updated
+        for LengthSize struct.
+
+        * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.cpp:
+        (WebCore::CDMSessionAVFoundationCF::CDMSessionAVFoundationCF): Take a reference.
+        Don't bother setting m_client since we never use it.
+        (WebCore::CDMSessionAVFoundationCF::generateKeyRequest): Clean up code a bit
+        by using auto a lot more.
+        * platform/graphics/avfoundation/cf/CDMSessionAVFoundationCF.h: Added include
+        that is now needed since it was removed from the base class. Tidied the class
+        up a bit, marking it final, making everything private, taking a reference, and
+        removing an unused data member, m_client.
+
+        * platform/graphics/avfoundation/cf/MediaPlayerPrivateAVFoundationCF.cpp:
+        (WebCore::MediaPlayerPrivateAVFoundationCF::createSession): Pass a reference.
+
+        * platform/graphics/avfoundation/objc/CDMSessionAVFoundationObjC.h:
+        added include of WTFString.h, now needed because of removing an unneeded
+        include from another header file.
+
+        * platform/graphics/ca/GraphicsLayerCA.cpp:
+        (WebCore::GraphicsLayerCA::animationCanBeAccelerated): Updated since trigger
+        is a raw pointer now.
+        (WebCore::GraphicsLayerCA::timingFunctionForAnimationValue): Updated to
+        return a reference rather than a pointer.
+        (WebCore::GraphicsLayerCA::setAnimationEndpoints): Updated for the above change.
+        (WebCore::GraphicsLayerCA::setAnimationKeyframes): Ditto.
+        (WebCore::GraphicsLayerCA::setTransformAnimationEndpoints): Ditto.
+        (WebCore::GraphicsLayerCA::setTransformAnimationKeyframes): Ditto.
+        (WebCore::GraphicsLayerCA::setFilterAnimationEndpoints): Ditto.
+        (WebCore::GraphicsLayerCA::setFilterAnimationKeyframes): Ditto.
+        * platform/graphics/ca/GraphicsLayerCA.h: Ditto.
+
+        * platform/ios/PlatformSpeechSynthesizerIOS.mm:
+        (-[WebSpeechSynthesisWrapper speakUtterance:]): CHanged argument to be a
+        RefPtr&& instead of a PassRefPtr.
+
+        * platform/mac/ThemeMac.mm:
+        (WebCore::sizeFromNSControlSize): Updated for LenghtSize struct.
+        (WebCore::checkboxSize): Ditto.
+        (WebCore::radioSize): Ditto.
+        (WebCore::ThemeMac::controlSize): Ditto.
+        (WebCore::ThemeMac::minimumControlSize): Ditto.
+
+        * platform/mac/WidgetMac.mm:
+        (WebCore::Widget::setFocus): Updated to pass a reference.
+
+        * platform/mock/DeviceMotionClientMock.cpp: Removed. Unused.
+        * platform/mock/DeviceMotionClientMock.h: Removed. Unused.
+
+        * platform/win/CursorWin.cpp:
+        (WebCore::createSharedCursor): Return a Ref instead of a PassRefPtr.
+        (WebCore::loadSharedCursor): Ditto.
+        (WebCore::loadCursorByName): Ditto.
+
+        * rendering/FilterEffectRenderer.cpp:
+        (WebCore::FilterEffectRenderer::output): Removed a no-longer-needed const_cast.
+        (WebCore::FilterEffectRenderer::outputRect): Ditto.
+
+        * rendering/ImageQualityController.cpp:
+        (WebCore::ImageQualityController::chooseInterpolationQuality): Tweaked formatting.
+
+        * rendering/InlineFlowBox.cpp:
+        (WebCore::InlineFlowBox::paintFillLayers): Updated to take a reference. Also
+        used a vector to iterate the linked list in reverse order instead of recursion.
+        (WebCore::InlineFlowBox::paintFillLayer): Take a reference.
+        (WebCore::InlineFlowBox::paintMask):
+        * rendering/InlineFlowBox.h: Updated for the above.
+
+        * rendering/RenderBox.cpp:
+        (WebCore::RenderBox::paintRootBoxFillLayers): Use auto a bit.
+        (WebCore::RenderBox::getBackgroundPaintedExtent): Use reference for the layers.
+        (WebCore::RenderBox::backgroundIsKnownToBeOpaqueInRect): Ditto.
+        (WebCore::RenderBox::backgroundHasOpaqueTopLayer): Ditto.
+        (WebCore::RenderBox::paintMaskImages): Ditto.
+        (WebCore::RenderBox::maskClipRect): Ditto.
+        (WebCore::RenderBox::paintFillLayers): Ditto.
+        (WebCore::RenderBox::paintFillLayer): Ditto.
+        (WebCore::layersUseImage): Ditto.
+        (WebCore::RenderBox::repaintLayerRectsForImage): Ditto.
+        * rendering/RenderBox.h: Updated for the above.
+
+        * rendering/RenderBoxModelObject.cpp:
+        (WebCore::RenderBoxModelObject::paintFillLayerExtended): Use reference for
+        the layers.
+        (WebCore::RenderBoxModelObject::calculateFillTileSize): Ditto.
+        (WebCore::RenderBoxModelObject::calculateBackgroundImageGeometry): Ditto.
+        (WebCore::RenderBoxModelObject::getGeometryForBackgroundImage): Ditto.
+        (WebCore::RenderBoxModelObject::boxShadowShouldBeAppliedToBackground): Ditto.
+        * rendering/RenderBoxModelObject.h: Updated for the above.
+
+        * rendering/RenderElement.cpp:
+        (WebCore::RenderElement::~RenderElement): Use references for the layers.
+        (WebCore::RenderElement::adjustStyleDifference): Ditto.
+        (WebCore::RenderElement::updateFillImages): Ditto.
+        (WebCore::RenderElement::setStyle): Use RenderStyle::replace to replace the
+        old style with the new style, and get the old one out at the same time.
+        (WebCore::RenderElement::styleDidChange): Use references for the layers.
+        (WebCore::mustRepaintFillLayers): Ditto.
+        (WebCore::RenderElement::repaintAfterLayoutIfNeeded): Ditto.
+        * rendering/RenderElement.h: Updated for the above.
+
+        * rendering/RenderGrid.cpp:
+        (WebCore::RenderGrid::computeContentPositionAndDistributionOffset):
+        Refactor so we don't need so many functions in RenderStyle.
+        * rendering/RenderMenuList.cpp:
+        (WebCore::RenderMenuList::adjustInnerStyle): Ditto.
+
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::createScrollbar): Pass widget as reference to addChild.
+        Also did a few other tweaks and used more specific types.
+
+        * rendering/RenderLayerBacking.cpp:
+        (WebCore::canCreateTiledImage): Updated since layers are references.
+        (WebCore::RenderLayerBacking::updateDirectlyCompositedBackgroundImage): Ditto.
+
+        * rendering/RenderListBox.cpp:
+        (WebCore::RenderListBox::createScrollbar): Pass widget as reference to addChild.
+
+        * rendering/RenderTableCell.cpp:
+        (WebCore::RenderTableCell::paintBackgroundsBehindCell): Updated to use
+        references for layers.
+
+        * rendering/RenderTheme.cpp:
+        (WebCore::RenderTheme::adjustStyle): Use WTFMove to pass a LengthBox.
+        (WebCore::RenderTheme::isControlStyled): Updated since LengthSize is a struct,
+        more WTFMove, change since layers are ferences.
+
+        * rendering/RenderThemeEfl.cpp:
+        (WebCore::RenderThemeEfl::adjustSizeConstraints): Update for Length and
+        LengthSize changes.
+        (WebCore::RenderThemeEfl::paintThemePart): Use reference instead of pointer.
+        (WebCore::RenderThemeEfl::applyPartDescriptionFallback): Update for Length and
+        LengthSize changes.
+        (WebCore::RenderThemeEfl::applyPartDescription): Ditto.
+        (WebCore::RenderThemeEfl::adjustCheckboxStyle): Ditto.
+        (WebCore::RenderThemeEfl::adjustRadioStyle): Ditto.
+
+        * rendering/RenderThemeGtk.cpp:
+        (WebCore::borderRadiiFromStyle): Update for Length and LengthSize changes.
+
+        * rendering/RenderThemeIOS.mm:
+        (WebCore::RenderThemeIOS::adjustCheckboxStyle): Update for Length and
+        LengthSize changes.
+        (WebCore::RenderThemeIOS::isControlStyled): Ditto.
+        (WebCore::RenderThemeIOS::adjustRadioStyle): Ditto.
+        (WebCore::RenderThemeIOS::adjustRoundBorderRadius): Ditto.
+        (WebCore::RenderThemeIOS::paintMenuListButtonDecorations): Ditto.
+        (WebCore::RenderThemeIOS::adjustSliderTrackStyle): Ditto.
+        (WebCore::RenderThemeIOS::adjustSliderThumbSize): Ditto.
+
+        * rendering/RenderWidget.cpp:
+        (WebCore::WidgetHierarchyUpdatesSuspensionScope::moveWidgets): Use move
+        insteead of swap and modern for loop instead of iterators.
+        (WebCore::moveWidgetToParentSoon): Take a reference instead of a pointer.
+        (WebCore::RenderWidget::setWidget): Update for above change.
+        (WebCore::RenderWidget::find): Take a reference instead of a pointer.
+        * rendering/RenderWidget.h: Updated for above changes.
+
+        * rendering/TextAutoSizing.cpp:
+        (WebCore::TextAutoSizingValue::reset): Updated since Length is passed as
+        rvalue reference now.
+
+        * rendering/mathml/MathMLStyle.cpp:
+        (WebCore::MathMLStyle::getMathMLStyle): Updated since mathMLStyle returns
+        a reference.
+        (WebCore::MathMLStyle::resolveMathMLStyleTree): Ditto.
+
+        * rendering/mathml/RenderMathMLBlock.h:
+        (WebCore::RenderMathMLBlock::mathMLStyle): Removed no-longer needed const_cast,
+        changed to return a reference rather than a pointer.
+        (WebCore::RenderMathMLTable::mathMLStyle): Ditto.
+
+        * rendering/mathml/RenderMathMLFraction.cpp:
+        (WebCore::RenderMathMLFraction::fractionParameters): Updated since mathMLStyle
+        returns a reference.
+        (WebCore::RenderMathMLFraction::stackParameters): Ditto.
+        * rendering/mathml/RenderMathMLOperator.h:
+        (WebCore::RenderMathMLOperator::isLargeOperatorInDisplayStyle): Ditto.
+        (WebCore::RenderMathMLOperator::shouldMoveLimits): Ditto.
+        * rendering/mathml/RenderMathMLRoot.cpp:
+        (WebCore::RenderMathMLRoot::verticalParameters): Ditto.
+        * rendering/mathml/RenderMathMLToken.cpp:
+        (WebCore::RenderMathMLToken::updateMathVariantGlyph): Ditto.
+
+        * rendering/style/BasicShapes.cpp:
+        (WebCore::floatSizeForLengthSize): Updated for LengthSize struct.
+        * rendering/style/BorderData.h:
+        (WebCore::BorderData::BorderData): Ditto.
+        (WebCore::BorderData::hasBorderRadius): Ditto.
+
+        * rendering/style/ContentData.cpp:
+        (WebCore::ContentData::clone): Updated member names.
+        * rendering/style/ContentData.h: Ditto.
+
+        * rendering/style/NinePieceImage.cpp:
+        (WebCore::NinePieceImage::computeSlices): Use initializer lists so we get
+        move optimization without requiring explicit WTFMove.
+
+        * rendering/style/DataRef.h:
+        (WebCore::DataRef::DataRef): Removed no-longer needed const_cast.
+        (WebCore::DataRef::replace): Added. This function is like Ref::replace, and
+        can be used to put a new value in and get an old value out without running into
+        the rule Ref has about not being reused once it becomes null because of being
+        moved out of. This function is a lot like std::exchange.
+        (WebCore::DataRef::operator const T&): Added operator so we can use these
+        as references without any function call in read-only contexts.
+        (WebCore::DataRef::get): Changed to return a reference rather than pointer.
+        (WebCore::DataRef::access): Ditto.
+
+        * rendering/style/KeyframeList.cpp:
+        (WebCore::KeyframeValue::timingFunction): Updated since timingFunction
+        returns a raw pointer.
+        (WebCore::KeyframeList::~KeyframeList): Removed unneeded call to clear,
+        which does things that are redundant since we are about to destroy all the
+        data members.
+        (WebCore::KeyframeList::operator==): Tweaked codign style a bit.
+
+        * rendering/style/NinePieceImage.h: Updated most functions in this class
+        for the changes to DataRef.
+
+        * rendering/style/RenderStyle.cpp: Updated nearly every function in this
+        class for the changes to DataRef, to eliminate the peculiar naming and use
+        our standard data member naming, m_memberName in a class, and memberName in a
+        struct or struct-like class for publicly accessible members, to pass, take,
+        and return more references and rvalue references, and to use modern for loops.
+        Other changes listed below function by function.
+        (WebCore::RenderStyle::defaultStyle): Use NeverDestroyed instead of allocating
+        on the heap.
+        (WebCore::RenderStyle::RenderStyle): Added a new constructor that performs
+        the replace operation, using a combination of DataRef::replace and std::exchange.
+        (WebCore::RenderStyle::replace): Added. Calls the above constructor.
+        (WebCore::RenderStyle::setScrollSnapType): Use SET_NESTED_VAR so we get equality
+        checks on this property, for the normal efficiency benefit.
+        (WebCore::RenderStyle::setDashboardRegion): Moved this here from the header.
+        (WebCore::RenderStyle::appendContent): Deleted.
+        (WebCore::RenderStyle::setContent): Refactored this set of functions to simplify.
+
+        * rendering/style/RenderStyle.h: Updated most functions as mentioned above.
+        Also updated macros to use the do/while(0) technique. Removed the long list of
+        friend classes with the elaborate comments; turned out none needed friendship
+        despite the comments. Made more things private. Moved large functions out of the
+        class definition.
+        (WebCore::RenderStyle::getTextShadowExtent): Deleted.
+        (WebCore::RenderStyle::getTextShadowHorizontalExtent): Deleted.
+        (WebCore::RenderStyle::getTextShadowVerticalExtent): Deleted.
+        (WebCore::RenderStyle::aspectRatio): Deleted.
+        (WebCore::RenderStyle::alignContentPosition): Deleted.
+        (WebCore::RenderStyle::alignContentDistribution): Deleted.
+        (WebCore::RenderStyle::alignContentOverflowAlignment): Deleted.
+        (WebCore::RenderStyle::alignItemsPosition): Deleted.
+        (WebCore::RenderStyle::alignItemsOverflowAlignment): Deleted.
+        (WebCore::RenderStyle::alignSelfPosition): Deleted.
+        (WebCore::RenderStyle::alignSelfOverflowAlignment): Deleted.
+        (WebCore::RenderStyle::justifyContentPosition): Deleted.
+        (WebCore::RenderStyle::justifyContentDistribution): Deleted.
+        (WebCore::RenderStyle::justifyContentOverflowAlignment): Deleted.
+        (WebCore::RenderStyle::justifyItemsPosition): Deleted.
+        (WebCore::RenderStyle::justifyItemsOverflowAlignment): Deleted.
+        (WebCore::RenderStyle::justifyItemsPositionType): Deleted.
+        (WebCore::RenderStyle::justifySelfPosition): Deleted.
+        (WebCore::RenderStyle::justifySelfOverflowAlignment): Deleted.
+        (WebCore::RenderStyle::setAlignContentPosition): Deleted.
+        (WebCore::RenderStyle::setAlignContentOverflow): Deleted.
+        (WebCore::RenderStyle::setAlignContentDistribution): Deleted.
+        (WebCore::RenderStyle::setAlignItemsOverflow): Deleted.
+        (WebCore::RenderStyle::setAlignSelfOverflow): Deleted.
+        (WebCore::RenderStyle::setJustifyContentOverflow): Deleted.
+        (WebCore::RenderStyle::setJustifyContentDistribution): Deleted.
+        (WebCore::RenderStyle::setJustifyItemsPosition): Deleted.
+        (WebCore::RenderStyle::setJustifyItemsOverflow): Deleted.
+        (WebCore::RenderStyle::setJustifyItemsPositionType): Deleted.
+        (WebCore::RenderStyle::setJustifySelfPosition): Deleted.
+        (WebCore::RenderStyle::setJustifySelfOverflow): Deleted.
+        (WebCore::RenderStyle::noninheritedFlagsMemoryOffset): Deleted.
+
+        * rendering/style/SVGRenderStyle.cpp: Similar changes to RenderStyle.cpp above.
+        * rendering/style/SVGRenderStyle.h: Ditto.
+
+        * rendering/style/ShapeValue.h:
+        (WebCore::ShapeValue::create): Take a Ref&& instead of a RefPtr.
+        (WebCore::ShapeValue::ShapeValue): Ditto.
+
+        * rendering/style/StyleBackgroundData.cpp: Update data member names.
+        * rendering/style/StyleBackgroundData.h: Ditto; make them public and remove the
+        getter functions.
+
+        * rendering/style/StyleCachedImage.cpp:
+        (WebCore::StyleCachedImage::cssValue): Removed no-longer-needed const_cast.
+
+        * rendering/style/StyleCustomPropertyData.h: Update data member names.
+        (WebCore::StyleCustomPropertyData::operator==): Removed unnecessary reference
+        count churn.
+        (WebCore::StyleCustomPropertyData::setCustomPropertyValue): Take an rvalue
+        reference.
+        (WebCore::StyleCustomPropertyData::getCustomPropertyValue): Deleted.
+        (WebCore::StyleCustomPropertyData::values): Deleted.
+        (WebCore::StyleCustomPropertyData::hasCustomProperty): Deleted.
+        (WebCore::StyleCustomPropertyData::containsVariables): Deleted.
+        (WebCore::StyleCustomPropertyData::setContainsVariables): Deleted.
+
+        * rendering/style/StyleFilterData.cpp: Update data member names.
+        * rendering/style/StyleFilterData.h: Ditto.
+        * rendering/style/StyleFlexibleBoxData.cpp: Ditto.
+        * rendering/style/StyleFlexibleBoxData.h: Ditto.
+        * rendering/style/StyleGridData.cpp: Ditto.
+        * rendering/style/StyleGridData.h: Ditto.
+        * rendering/style/StyleGridItemData.cpp: Ditto.
+        * rendering/style/StyleGridItemData.h: Ditto.
+
+        * rendering/style/StyleGeneratedImage.cpp:
+        (WebCore::StyleGeneratedImage::cssValue): Removed no-longer-needed const_cast.
+        (WebCore::StyleGeneratedImage::imageSize): Ditto.
+        (WebCore::StyleGeneratedImage::image): Ditto.
+
+        * rendering/style/StyleInheritedData.cpp: Update data member names.
+        * rendering/style/StyleInheritedData.h: Ditto.
+        * rendering/style/StyleRareInheritedData.cpp: Ditto.
+        * rendering/style/StyleRareInheritedData.h: Ditto.
+        * rendering/style/StyleMultiColData.cpp: Ditto.
+        * rendering/style/StyleMultiColData.h: Ditto.
+        * rendering/style/StyleRareNonInheritedData.cpp: Ditto.
+        * rendering/style/StyleRareNonInheritedData.h: Ditto.
+        * rendering/style/StyleTransformData.cpp: Ditto.
+        * rendering/style/StyleTransformData.h: Ditto.
+        * rendering/style/StyleVisualData.cpp: Ditto.
+        * rendering/style/StyleVisualData.h: Ditto.
+
+        * style/StylePendingResources.cpp:
+        (WebCore::Style::loadPendingResources): Update since layers are references.
+
+
 2017-01-13  Chris Dumez  <cdumez@apple.com>
 
         [WK2] Add diagnostic logging to measure WebGL usage
         this new class to handle the settings of the audio elements. The
         class initializes the settings and the supportedSettings.
 
-
 2017-01-08  Konstantin Tokarev  <annulen@yandex.ru>
 
         Introduce CPU(X86_SSE2) instead of various SSE2 checks
index d8bc7a5..6746f4e 100644 (file)
@@ -37,7 +37,7 @@ Ref<SpeechSynthesisUtterance> SpeechSynthesisUtterance::create(ScriptExecutionCo
 
 SpeechSynthesisUtterance::SpeechSynthesisUtterance(ScriptExecutionContext& context, const String& text)
     : ContextDestructionObserver(&context)
-    , m_platformUtterance(PlatformSpeechSynthesisUtterance::create(this))
+    , m_platformUtterance(PlatformSpeechSynthesisUtterance::create(*this))
 {
     m_platformUtterance->setText(text);
 }
index 5f14197..b5cb520 100644 (file)
@@ -39,7 +39,7 @@ class SpeechSynthesisUtterance final : public PlatformSpeechSynthesisUtteranceCl
 public:
     static Ref<SpeechSynthesisUtterance> create(ScriptExecutionContext&, const String&);
 
-    ~SpeechSynthesisUtterance();
+    virtual ~SpeechSynthesisUtterance();
 
     const String& text() const { return m_platformUtterance->text(); }
     void setText(const String& text) { m_platformUtterance->setText(text); }
@@ -62,21 +62,21 @@ public:
     double startTime() const { return m_platformUtterance->startTime(); }
     void setStartTime(double startTime) { m_platformUtterance->setStartTime(startTime); }
 
-    using RefCounted<SpeechSynthesisUtterance>::ref;
-    using RefCounted<SpeechSynthesisUtterance>::deref;
-
-    ScriptExecutionContext* scriptExecutionContext() const override { return ContextDestructionObserver::scriptExecutionContext(); }
+    using RefCounted::ref;
+    using RefCounted::deref;
 
     PlatformSpeechSynthesisUtterance* platformUtterance() const { return m_platformUtterance.get(); }
 
 private:
     SpeechSynthesisUtterance(ScriptExecutionContext&, const String&);
+
+    ScriptExecutionContext* scriptExecutionContext() const final { return ContextDestructionObserver::scriptExecutionContext(); }
+    EventTargetInterface eventTargetInterface() const final { return SpeechSynthesisUtteranceEventTargetInterfaceType; }
+    void refEventTarget() final { ref(); }
+    void derefEventTarget() final { deref(); }
+
     RefPtr<PlatformSpeechSynthesisUtterance> m_platformUtterance;
     RefPtr<SpeechSynthesisVoice> m_voice;
-
-    EventTargetInterface eventTargetInterface() const override { return SpeechSynthesisUtteranceEventTargetInterfaceType; }
-    void refEventTarget() override { ref(); }
-    void derefEventTarget() override { deref(); }
 };
 
 } // namespace WebCore
index 2307e57..960fcf5 100644 (file)
@@ -450,8 +450,8 @@ namespace Detail {
 
 template <typename T> inline T* getPtrOrRef(const T* p) { return const_cast<T*>(p); }
 template <typename T> inline T& getPtrOrRef(const T& p) { return const_cast<T&>(p); }
-template <typename T> inline T* getPtrOrRef(const RefPtr<T>& p) { return const_cast<T*>(p.get()); }
-template <typename T> inline T& getPtrOrRef(const Ref<T>& p) { return const_cast<T&>(p.get()); }
+template <typename T> inline T* getPtrOrRef(const RefPtr<T>& p) { return p.get(); }
+template <typename T> inline T& getPtrOrRef(const Ref<T>& p) { return p.get(); }
 
 }
 
index 38529bb..6f37462 100644 (file)
@@ -79,7 +79,7 @@ public:
     typedef ImplementationClass DOMWrapped;
     static constexpr bool isDOMWrapper = true;
 
-    ImplementationClass& wrapped() const { return const_cast<ImplementationClass&>(m_wrapped.get()); }
+    ImplementationClass& wrapped() const { return m_wrapped; }
     static ptrdiff_t offsetOfWrapped() { return OBJECT_OFFSETOF(JSDOMWrapper<ImplementationClass>, m_wrapped); }
 
 protected:
index 62a8967..f4006fc 100644 (file)
@@ -53,10 +53,9 @@ ScriptModuleLoader::ScriptModuleLoader(Document& document)
 ScriptModuleLoader::~ScriptModuleLoader()
 {
     for (auto& loader : m_loaders)
-        const_cast<CachedModuleScriptLoader&>(loader.get()).clearClient();
+        loader->clearClient();
 }
 
-
 static bool isRootModule(JSC::JSValue importerModuleKey)
 {
     return importerModuleKey.isSymbol() || importerModuleKey.isUndefined();
index 08864fa..5f225f7 100644 (file)
@@ -144,18 +144,16 @@ static Length convertToLength(const CSSToLengthConversionData& conversionData, c
 static LengthSize convertToLengthSize(const CSSToLengthConversionData& conversionData, const CSSPrimitiveValue* value)
 {
     if (!value)
-        return LengthSize(Length(0, Fixed), Length(0, Fixed));
+        return { { 0, Fixed }, { 0, Fixed } };
 
-    Pair* pair = value->pairValue();
-    return LengthSize(convertToLength(conversionData, pair->first()), convertToLength(conversionData, pair->second()));
+    auto& pair = *value->pairValue();
+    return { convertToLength(conversionData, pair.first()), convertToLength(conversionData, pair.second()) };
 }
 
 static BasicShapeCenterCoordinate convertToCenterCoordinate(const CSSToLengthConversionData& conversionData, CSSPrimitiveValue* value)
 {
-    BasicShapeCenterCoordinate::Direction direction;
-    Length offset = Length(0, Fixed);
-
     CSSValueID keyword = CSSValueTop;
+    Length offset { 0, Fixed };
     if (!value)
         keyword = CSSValueCenter;
     else if (value->isValueID())
@@ -166,6 +164,7 @@ static BasicShapeCenterCoordinate convertToCenterCoordinate(const CSSToLengthCon
     } else
         offset = convertToLength(conversionData, value);
 
+    BasicShapeCenterCoordinate::Direction direction;
     switch (keyword) {
     case CSSValueTop:
     case CSSValueLeft:
index 2fbe9c1..fdd294c 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2004 Zack Rusin <zack@kde.org>
- * Copyright (C) 2004-2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
  * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org>
  * Copyright (C) 2007 Nicholas Shanks <webkit@nickshanks.com>
  * Copyright (C) 2011 Sencha, Inc. All rights reserved.
@@ -606,11 +606,10 @@ static Ref<CSSPrimitiveValue> valueForNinePieceImageQuad(const LengthBox& box)
 static Ref<CSSValue> valueForNinePieceImageRepeat(const NinePieceImage& image)
 {
     auto& cssValuePool = CSSValuePool::singleton();
-    RefPtr<CSSPrimitiveValue> horizontalRepeat = cssValuePool.createIdentifierValue(valueForRepeatRule(image.horizontalRule()));
-
+    auto horizontalRepeat = cssValuePool.createIdentifierValue(valueForRepeatRule(image.horizontalRule()));
     RefPtr<CSSPrimitiveValue> verticalRepeat;
     if (image.horizontalRule() == image.verticalRule())
-        verticalRepeat = horizontalRepeat;
+        verticalRepeat = horizontalRepeat.copyRef();
     else
         verticalRepeat = cssValuePool.createIdentifierValue(valueForRepeatRule(image.verticalRule()));
     return cssValuePool.createValue(Pair::create(WTFMove(horizontalRepeat), WTFMove(verticalRepeat)));
@@ -688,20 +687,20 @@ static Ref<CSSValue> valueForReflection(const StyleReflection* reflection, const
     return CSSReflectValue::create(direction.releaseNonNull(), offset.releaseNonNull(), valueForNinePieceImage(reflection->mask()));
 }
 
-static Ref<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID, const FillLayer* layer, const RenderStyle& style)
+static Ref<CSSValueList> createPositionListForLayer(CSSPropertyID propertyID, const FillLayer& layer, const RenderStyle& style)
 {
-    auto positionList = CSSValueList::createSpaceSeparated();
-    if (layer->isBackgroundXOriginSet()) {
+    auto list = CSSValueList::createSpaceSeparated();
+    if (layer.isBackgroundXOriginSet()) {
         ASSERT_UNUSED(propertyID, propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
-        positionList.get().append(CSSValuePool::singleton().createValue(layer->backgroundXOrigin()));
+        list->append(CSSValuePool::singleton().createValue(layer.backgroundXOrigin()));
     }
-    positionList.get().append(zoomAdjustedPixelValueForLength(layer->xPosition(), style));
-    if (layer->isBackgroundYOriginSet()) {
+    list->append(zoomAdjustedPixelValueForLength(layer.xPosition(), style));
+    if (layer.isBackgroundYOriginSet()) {
         ASSERT(propertyID == CSSPropertyBackgroundPosition || propertyID == CSSPropertyWebkitMaskPosition);
-        positionList.get().append(CSSValuePool::singleton().createValue(layer->backgroundYOrigin()));
+        list->append(CSSValuePool::singleton().createValue(layer.backgroundYOrigin()));
     }
-    positionList.get().append(zoomAdjustedPixelValueForLength(layer->yPosition(), style));
-    return positionList;
+    list->append(zoomAdjustedPixelValueForLength(layer.yPosition(), style));
+    return list;
 }
 
 static RefPtr<CSSValue> positionOffsetValue(const RenderStyle& style, CSSPropertyID propertyID)
@@ -765,39 +764,38 @@ static Ref<CSSPrimitiveValue> autoOrZoomAdjustedValue(Length length, const Rende
     return zoomAdjustedPixelValue(valueForLength(length, 0), style);
 }
 
-static Ref<CSSValueList> getBorderRadiusCornerValues(const LengthSize& radius, const RenderStyle& style)
+static Ref<CSSValueList> borderRadiusCornerValues(const LengthSize& radius, const RenderStyle& style)
 {
     auto list = CSSValueList::createSpaceSeparated();
-    list.get().append(percentageOrZoomAdjustedValue(radius.width(), style));
-    list.get().append(percentageOrZoomAdjustedValue(radius.height(), style));
+    list->append(percentageOrZoomAdjustedValue(radius.width, style));
+    list->append(percentageOrZoomAdjustedValue(radius.height, style));
     return list;
 }
 
-static Ref<CSSValue> getBorderRadiusCornerValue(const LengthSize& radius, const RenderStyle& style)
+static Ref<CSSValue> borderRadiusCornerValue(const LengthSize& radius, const RenderStyle& style)
 {
-    if (radius.width() == radius.height())
-        return percentageOrZoomAdjustedValue(radius.width(), style);
-
-    return getBorderRadiusCornerValues(radius, style);
+    if (radius.width == radius.height)
+        return percentageOrZoomAdjustedValue(radius.width, style);
+    return borderRadiusCornerValues(radius, style);
 }
 
-static Ref<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle& style)
+static Ref<CSSValueList> borderRadiusShorthandValue(const RenderStyle& style)
 {
     auto list = CSSValueList::createSlashSeparated();
-    bool showHorizontalBottomLeft = style.borderTopRightRadius().width() != style.borderBottomLeftRadius().width();
-    bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBottomRightRadius().width() != style.borderTopLeftRadius().width());
-    bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopRightRadius().width() != style.borderTopLeftRadius().width());
+    bool showHorizontalBottomLeft = style.borderTopRightRadius().width != style.borderBottomLeftRadius().width;
+    bool showHorizontalBottomRight = showHorizontalBottomLeft || (style.borderBottomRightRadius().width != style.borderTopLeftRadius().width);
+    bool showHorizontalTopRight = showHorizontalBottomRight || (style.borderTopRightRadius().width != style.borderTopLeftRadius().width);
 
-    bool showVerticalBottomLeft = style.borderTopRightRadius().height() != style.borderBottomLeftRadius().height();
-    bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottomRightRadius().height() != style.borderTopLeftRadius().height());
-    bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRightRadius().height() != style.borderTopLeftRadius().height());
+    bool showVerticalBottomLeft = style.borderTopRightRadius().height != style.borderBottomLeftRadius().height;
+    bool showVerticalBottomRight = showVerticalBottomLeft || (style.borderBottomRightRadius().height != style.borderTopLeftRadius().height);
+    bool showVerticalTopRight = showVerticalBottomRight || (style.borderTopRightRadius().height != style.borderTopLeftRadius().height);
 
-    RefPtr<CSSValueList> topLeftRadius = getBorderRadiusCornerValues(style.borderTopLeftRadius(), style);
-    RefPtr<CSSValueList> topRightRadius = getBorderRadiusCornerValues(style.borderTopRightRadius(), style);
-    RefPtr<CSSValueList> bottomRightRadius = getBorderRadiusCornerValues(style.borderBottomRightRadius(), style);
-    RefPtr<CSSValueList> bottomLeftRadius = getBorderRadiusCornerValues(style.borderBottomLeftRadius(), style);
+    auto topLeftRadius = borderRadiusCornerValues(style.borderTopLeftRadius(), style);
+    auto topRightRadius = borderRadiusCornerValues(style.borderTopRightRadius(), style);
+    auto bottomRightRadius = borderRadiusCornerValues(style.borderBottomRightRadius(), style);
+    auto bottomLeftRadius = borderRadiusCornerValues(style.borderBottomLeftRadius(), style);
 
-    RefPtr<CSSValueList> horizontalRadii = CSSValueList::createSpaceSeparated();
+    auto horizontalRadii = CSSValueList::createSpaceSeparated();
     horizontalRadii->append(*topLeftRadius->item(0));
     if (showHorizontalTopRight)
         horizontalRadii->append(*topRightRadius->item(0));
@@ -806,9 +804,9 @@ static Ref<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle& style)
     if (showHorizontalBottomLeft)
         horizontalRadii->append(*bottomLeftRadius->item(0));
 
-    list.get().append(horizontalRadii.releaseNonNull());
+    list->append(WTFMove(horizontalRadii));
 
-    RefPtr<CSSValueList> verticalRadiiList = CSSValueList::createSpaceSeparated();
+    auto verticalRadiiList = CSSValueList::createSpaceSeparated();
     verticalRadiiList->append(*topLeftRadius->item(1));
     if (showVerticalTopRight)
         verticalRadiiList->append(*topRightRadius->item(1));
@@ -817,8 +815,8 @@ static Ref<CSSValueList> getBorderRadiusShorthandValue(const RenderStyle& style)
     if (showVerticalBottomLeft)
         verticalRadiiList->append(*bottomLeftRadius->item(1));
 
-    if (!verticalRadiiList->equals(downcast<CSSValueList>(*list.get().item(0))))
-        list.get().append(verticalRadiiList.releaseNonNull());
+    if (!verticalRadiiList->equals(downcast<CSSValueList>(*list->item(0))))
+        list->append(WTFMove(verticalRadiiList));
 
     return list;
 }
@@ -887,7 +885,7 @@ static Ref<CSSValue> computedTransform(RenderObject* renderer, const RenderStyle
 
     // FIXME: Need to print out individual functions (https://bugs.webkit.org/show_bug.cgi?id=23924)
     auto list = CSSValueList::createSpaceSeparated();
-    list.get().append(matrixTransformValue(transform, style));
+    list->append(matrixTransformValue(transform, style));
     return WTFMove(list);
 }
 
@@ -934,7 +932,7 @@ Ref<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderStyle& style, c
 
         if (filterOperation.type() == FilterOperation::REFERENCE) {
             ReferenceFilterOperation& referenceOperation = downcast<ReferenceFilterOperation>(filterOperation);
-            list.get().append(cssValuePool.createValue(referenceOperation.url(), CSSPrimitiveValue::CSS_URI));
+            list->append(cssValuePool.createValue(referenceOperation.url(), CSSPrimitiveValue::CSS_URI));
         } else {
             RefPtr<CSSFunctionValue> filterValue;
             switch (filterOperation.type()) {
@@ -996,7 +994,7 @@ Ref<CSSValue> ComputedStyleExtractor::valueForFilter(const RenderStyle& style, c
                 filterValue = CSSFunctionValue::create(CSSValueInvalid);
                 break;
             }
-            list.get().append(filterValue.releaseNonNull());
+            list->append(filterValue.releaseNonNull());
         }
     }
     return WTFMove(list);
@@ -1166,7 +1164,7 @@ static Ref<CSSValue> valueForGridTrackList(GridTrackSizingDirection direction, R
     } else {
         for (unsigned i = 0; i < trackSizes.size(); ++i) {
             addValuesForNamedGridLinesAtIndex(collector, i, list.get());
-            list.get().append(specifiedValueForGridTrackSize(trackSizes[i], style));
+            list->append(specifiedValueForGridTrackSize(trackSizes[i], style));
         }
         insertionIndex = trackSizes.size();
     }
@@ -1187,13 +1185,13 @@ static Ref<CSSValue> valueForGridPosition(const GridPosition& position)
 
     auto list = CSSValueList::createSpaceSeparated();
     if (position.isSpan()) {
-        list.get().append(cssValuePool.createIdentifierValue(CSSValueSpan));
-        list.get().append(cssValuePool.createValue(position.spanPosition(), CSSPrimitiveValue::CSS_NUMBER));
+        list->append(cssValuePool.createIdentifierValue(CSSValueSpan));
+        list->append(cssValuePool.createValue(position.spanPosition(), CSSPrimitiveValue::CSS_NUMBER));
     } else
-        list.get().append(cssValuePool.createValue(position.integerPosition(), CSSPrimitiveValue::CSS_NUMBER));
+        list->append(cssValuePool.createValue(position.integerPosition(), CSSPrimitiveValue::CSS_NUMBER));
 
     if (!position.namedGridLine().isNull())
-        list.get().append(cssValuePool.createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING));
+        list->append(cssValuePool.createValue(position.namedGridLine(), CSSPrimitiveValue::CSS_STRING));
     return WTFMove(list);
 }
 #endif
@@ -1207,14 +1205,14 @@ static Ref<CSSValue> createTransitionPropertyValue(const Animation& animation)
     return CSSValuePool::singleton().createValue(getPropertyNameString(animation.property()), CSSPrimitiveValue::CSS_STRING);
 }
 
-static Ref<CSSValueList> getTransitionPropertyValue(const AnimationList* animList)
+static Ref<CSSValueList> transitionPropertyValue(const AnimationList* animationList)
 {
     auto list = CSSValueList::createCommaSeparated();
-    if (animList) {
-        for (size_t i = 0; i < animList->size(); ++i)
-            list.get().append(createTransitionPropertyValue(animList->animation(i)));
+    if (animationList) {
+        for (size_t i = 0; i < animationList->size(); ++i)
+            list->append(createTransitionPropertyValue(animationList->animation(i)));
     } else
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueAll));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueAll));
     return list;
 }
 
@@ -1242,7 +1240,7 @@ static Ref<CSSValueList> valueForScrollSnapAlignment(const ScrollSnapAlign& alig
 
 #endif
 
-static Ref<CSSValue> getWillChangePropertyValue(const WillChangeData* willChangeData)
+static Ref<CSSValue> willChangePropertyValue(const WillChangeData* willChangeData)
 {
     auto& cssValuePool = CSSValuePool::singleton();
     if (!willChangeData || !willChangeData->numFeatures())
@@ -1253,13 +1251,13 @@ static Ref<CSSValue> getWillChangePropertyValue(const WillChangeData* willChange
         WillChangeData::FeaturePropertyPair feature = willChangeData->featureAt(i);
         switch (feature.first) {
         case WillChangeData::ScrollPosition:
-            list.get().append(cssValuePool.createIdentifierValue(CSSValueScrollPosition));
+            list->append(cssValuePool.createIdentifierValue(CSSValueScrollPosition));
             break;
         case WillChangeData::Contents:
-            list.get().append(cssValuePool.createIdentifierValue(CSSValueContents));
+            list->append(cssValuePool.createIdentifierValue(CSSValueContents));
             break;
         case WillChangeData::Property:
-            list.get().append(cssValuePool.createIdentifierValue(feature.second));
+            list->append(cssValuePool.createIdentifierValue(feature.second));
             break;
         case WillChangeData::Invalid:
             ASSERT_NOT_REACHED();
@@ -1456,39 +1454,39 @@ static Ref<CSSValue> fontVariantEastAsianPropertyValue(FontVariantEastAsianVaria
     return WTFMove(valueList);
 }
 
-static Ref<CSSValueList> getDelayValue(const AnimationList* animList)
+static Ref<CSSValueList> delayValue(const AnimationList* animationList)
 {
     auto& cssValuePool = CSSValuePool::singleton();
     auto list = CSSValueList::createCommaSeparated();
-    if (animList) {
-        for (size_t i = 0; i < animList->size(); ++i)
-            list.get().append(cssValuePool.createValue(animList->animation(i).delay(), CSSPrimitiveValue::CSS_S));
+    if (animationList) {
+        for (size_t i = 0; i < animationList->size(); ++i)
+            list->append(cssValuePool.createValue(animationList->animation(i).delay(), CSSPrimitiveValue::CSS_S));
     } else {
         // Note that initialAnimationDelay() is used for both transitions and animations
-        list.get().append(cssValuePool.createValue(Animation::initialDelay(), CSSPrimitiveValue::CSS_S));
+        list->append(cssValuePool.createValue(Animation::initialDelay(), CSSPrimitiveValue::CSS_S));
     }
     return list;
 }
 
-static Ref<CSSValueList> getDurationValue(const AnimationList* animList)
+static Ref<CSSValueList> durationValue(const AnimationList* animationList)
 {
     auto& cssValuePool = CSSValuePool::singleton();
     auto list = CSSValueList::createCommaSeparated();
-    if (animList) {
-        for (size_t i = 0; i < animList->size(); ++i)
-            list.get().append(cssValuePool.createValue(animList->animation(i).duration(), CSSPrimitiveValue::CSS_S));
+    if (animationList) {
+        for (size_t i = 0; i < animationList->size(); ++i)
+            list->append(cssValuePool.createValue(animationList->animation(i).duration(), CSSPrimitiveValue::CSS_S));
     } else {
         // Note that initialAnimationDuration() is used for both transitions and animations
-        list.get().append(cssValuePool.createValue(Animation::initialDuration(), CSSPrimitiveValue::CSS_S));
+        list->append(cssValuePool.createValue(Animation::initialDuration(), CSSPrimitiveValue::CSS_S));
     }
     return list;
 }
 
-static Ref<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunction)
+static Ref<CSSValue> createTimingFunctionValue(const TimingFunction& timingFunction)
 {
-    switch (timingFunction->type()) {
+    switch (timingFunction.type()) {
     case TimingFunction::CubicBezierFunction: {
-        auto& function = *static_cast<const CubicBezierTimingFunction*>(timingFunction);
+        auto& function = static_cast<const CubicBezierTimingFunction&>(timingFunction);
         if (function.timingFunctionPreset() != CubicBezierTimingFunction::Custom) {
             CSSValueID valueId = CSSValueInvalid;
             switch (function.timingFunctionPreset()) {
@@ -1511,59 +1509,60 @@ static Ref<CSSValue> createTimingFunctionValue(const TimingFunction* timingFunct
         return CSSCubicBezierTimingFunctionValue::create(function.x1(), function.y1(), function.x2(), function.y2());
     }
     case TimingFunction::StepsFunction: {
-        auto& function = *static_cast<const StepsTimingFunction*>(timingFunction);
+        auto& function = static_cast<const StepsTimingFunction&>(timingFunction);
         return CSSStepsTimingFunctionValue::create(function.numberOfSteps(), function.stepAtStart());
     }
     case TimingFunction::SpringFunction: {
-        auto& function = *static_cast<const SpringTimingFunction*>(timingFunction);
+        auto& function = static_cast<const SpringTimingFunction&>(timingFunction);
         return CSSSpringTimingFunctionValue::create(function.mass(), function.stiffness(), function.damping(), function.initialVelocity());
     }
     default:
-        ASSERT(timingFunction->type() == TimingFunction::LinearFunction);
+        ASSERT(timingFunction.type() == TimingFunction::LinearFunction);
         return CSSValuePool::singleton().createIdentifierValue(CSSValueLinear);
     }
 }
 
-static Ref<CSSValueList> getTimingFunctionValue(const AnimationList* animList)
+static Ref<CSSValueList> timingFunctionValue(const AnimationList* animationList)
 {
     auto list = CSSValueList::createCommaSeparated();
-    if (animList) {
-        for (size_t i = 0; i < animList->size(); ++i)
-            list.get().append(createTimingFunctionValue(animList->animation(i).timingFunction().get()));
+    if (animationList) {
+        for (size_t i = 0; i < animationList->size(); ++i)
+            list->append(createTimingFunctionValue(*animationList->animation(i).timingFunction()));
     } else
         // Note that initialAnimationTimingFunction() is used for both transitions and animations
-        list.get().append(createTimingFunctionValue(Animation::initialTimingFunction().get()));
+        list->append(createTimingFunctionValue(Animation::initialTimingFunction()));
     return list;
 }
 
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
-static Ref<CSSValue> createAnimationTriggerValue(const AnimationTrigger* trigger, const RenderStyle& style)
+
+static Ref<CSSValue> createAnimationTriggerValue(const AnimationTrigger& trigger, const RenderStyle& style)
 {
-    switch (trigger->type()) {
+    switch (trigger.type()) {
     case AnimationTrigger::AnimationTriggerType::ScrollAnimationTriggerType: {
-        auto& scrollAnimationTrigger = downcast<ScrollAnimationTrigger>(*trigger);
+        auto& scrollAnimationTrigger = downcast<ScrollAnimationTrigger>(trigger);
         if (scrollAnimationTrigger.endValue().isAuto())
             return CSSAnimationTriggerScrollValue::create(zoomAdjustedPixelValueForLength(scrollAnimationTrigger.startValue(), style));
         return CSSAnimationTriggerScrollValue::create(zoomAdjustedPixelValueForLength(scrollAnimationTrigger.startValue(), style),
                                                       zoomAdjustedPixelValueForLength(scrollAnimationTrigger.endValue(), style));
     }
     default:
-        ASSERT(trigger->type() == AnimationTrigger::AnimationTriggerType::AutoAnimationTriggerType);
+        ASSERT(trigger.type() == AnimationTrigger::AnimationTriggerType::AutoAnimationTriggerType);
         return CSSValuePool::singleton().createIdentifierValue(CSSValueAuto);
     }
 }
 
-static Ref<CSSValueList> getAnimationTriggerValue(const AnimationList* animList, const RenderStyle& style)
+static Ref<CSSValueList> animationTriggerValue(const AnimationList* animationList, const RenderStyle& style)
 {
     auto list = CSSValueList::createCommaSeparated();
-    if (animList) {
-        for (size_t i = 0; i < animList->size(); ++i)
-            list.get().append(createAnimationTriggerValue(animList->animation(i).trigger().get(), style));
+    if (animationList) {
+        for (size_t i = 0; i < animationList->size(); ++i)
+            list->append(createAnimationTriggerValue(*animationList->animation(i).trigger(), style));
     } else
-        list.get().append(createAnimationTriggerValue(Animation::initialTrigger().get(), style));
-
+        list->append(createAnimationTriggerValue(Animation::initialTrigger().get(), style));
     return list;
 }
+
 #endif
 
 static Ref<CSSValue> createLineBoxContainValue(unsigned lineBoxContain)
@@ -1700,7 +1699,7 @@ static Ref<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
 {
     auto& cssValuePool = CSSValuePool::singleton();
     // Blink value is ignored.
-    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    auto list = CSSValueList::createSpaceSeparated();
     if (textDecoration & TextDecorationUnderline)
         list->append(cssValuePool.createIdentifierValue(CSSValueUnderline));
     if (textDecoration & TextDecorationOverline)
@@ -1714,7 +1713,7 @@ static Ref<CSSValue> renderTextDecorationFlagsToCSSValue(int textDecoration)
 
     if (!list->length())
         return cssValuePool.createIdentifierValue(CSSValueNone);
-    return list.releaseNonNull();
+    return WTFMove(list);
 }
 
 static Ref<CSSValue> renderTextDecorationStyleFlagsToCSSValue(TextDecorationStyle textDecorationStyle)
@@ -1758,7 +1757,7 @@ static Ref<CSSValue> renderEmphasisPositionFlagsToCSSValue(TextEmphasisPosition
     ASSERT(!((textEmphasisPosition & TextEmphasisPositionOver) && (textEmphasisPosition & TextEmphasisPositionUnder)));
     ASSERT(!((textEmphasisPosition & TextEmphasisPositionLeft) && (textEmphasisPosition & TextEmphasisPositionRight)));
     auto& cssValuePool = CSSValuePool::singleton();
-    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    auto list = CSSValueList::createSpaceSeparated();
     if (textEmphasisPosition & TextEmphasisPositionOver)
         list->append(cssValuePool.createIdentifierValue(CSSValueOver));
     if (textEmphasisPosition & TextEmphasisPositionUnder)
@@ -1767,16 +1766,15 @@ static Ref<CSSValue> renderEmphasisPositionFlagsToCSSValue(TextEmphasisPosition
         list->append(cssValuePool.createIdentifierValue(CSSValueLeft));
     if (textEmphasisPosition & TextEmphasisPositionRight)
         list->append(cssValuePool.createIdentifierValue(CSSValueRight));
-
     if (!list->length())
         return cssValuePool.createIdentifierValue(CSSValueNone);
-    return list.releaseNonNull();
+    return WTFMove(list);
 }
 
 static Ref<CSSValue> hangingPunctuationToCSSValue(HangingPunctuation hangingPunctuation)
 {
     auto& cssValuePool = CSSValuePool::singleton();
-    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    auto list = CSSValueList::createSpaceSeparated();
     if (hangingPunctuation & FirstHangingPunctuation)
         list->append(cssValuePool.createIdentifierValue(CSSValueFirst));
     if (hangingPunctuation & AllowEndHangingPunctuation)
@@ -1787,7 +1785,7 @@ static Ref<CSSValue> hangingPunctuationToCSSValue(HangingPunctuation hangingPunc
         list->append(cssValuePool.createIdentifierValue(CSSValueLast));
     if (!list->length())
         return cssValuePool.createIdentifierValue(CSSValueNone);
-    return list.releaseNonNull();
+    return WTFMove(list);
 }
     
 static Ref<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepeat)
@@ -1803,8 +1801,8 @@ static Ref<CSSValue> fillRepeatToCSSValue(EFillRepeat xRepeat, EFillRepeat yRepe
         return cssValuePool.createIdentifierValue(CSSValueRepeatY);
 
     auto list = CSSValueList::createSpaceSeparated();
-    list.get().append(cssValuePool.createValue(xRepeat));
-    list.get().append(cssValuePool.createValue(yRepeat));
+    list->append(cssValuePool.createValue(xRepeat));
+    list->append(cssValuePool.createValue(yRepeat));
     return WTFMove(list);
 }
 
@@ -1827,40 +1825,40 @@ static Ref<CSSValue> fillSizeToCSSValue(const FillSize& fillSize, const RenderSt
     if (fillSize.type == Cover)
         return CSSValuePool::singleton().createIdentifierValue(CSSValueCover);
 
-    if (fillSize.size.height().isAuto())
-        return zoomAdjustedPixelValueForLength(fillSize.size.width(), style);
+    if (fillSize.size.height.isAuto())
+        return zoomAdjustedPixelValueForLength(fillSize.size.width, style);
 
     auto list = CSSValueList::createSpaceSeparated();
-    list.get().append(zoomAdjustedPixelValueForLength(fillSize.size.width(), style));
-    list.get().append(zoomAdjustedPixelValueForLength(fillSize.size.height(), style));
+    list->append(zoomAdjustedPixelValueForLength(fillSize.size.width, style));
+    list->append(zoomAdjustedPixelValueForLength(fillSize.size.height, style));
     return WTFMove(list);
 }
 
-static Ref<CSSValue> altTextToCSSValue(const RenderStyle* style)
+static Ref<CSSValue> altTextToCSSValue(const RenderStyle& style)
 {
-    return CSSValuePool::singleton().createValue(style->contentAltText(), CSSPrimitiveValue::CSS_STRING);
+    return CSSValuePool::singleton().createValue(style.contentAltText(), CSSPrimitiveValue::CSS_STRING);
 }
     
-static Ref<CSSValueList> contentToCSSValue(const RenderStyle* style)
+static Ref<CSSValueList> contentToCSSValue(const RenderStyle& style)
 {
     auto& cssValuePool = CSSValuePool::singleton();
     auto list = CSSValueList::createSpaceSeparated();
-    for (const ContentData* contentData = style->contentData(); contentData; contentData = contentData->next()) {
+    for (auto* contentData = style.contentData(); contentData; contentData = contentData->next()) {
         if (is<CounterContentData>(*contentData))
-            list.get().append(cssValuePool.createValue(downcast<CounterContentData>(*contentData).counter().identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME));
+            list->append(cssValuePool.createValue(downcast<CounterContentData>(*contentData).counter().identifier(), CSSPrimitiveValue::CSS_COUNTER_NAME));
         else if (is<ImageContentData>(*contentData))
-            list.get().append(downcast<ImageContentData>(*contentData).image().cssValue());
+            list->append(downcast<ImageContentData>(*contentData).image().cssValue());
         else if (is<TextContentData>(*contentData))
-            list.get().append(cssValuePool.createValue(downcast<TextContentData>(*contentData).text(), CSSPrimitiveValue::CSS_STRING));
+            list->append(cssValuePool.createValue(downcast<TextContentData>(*contentData).text(), CSSPrimitiveValue::CSS_STRING));
     }
-    if (style->hasFlowFrom())
-        list.get().append(cssValuePool.createValue(style->regionThread(), CSSPrimitiveValue::CSS_STRING));
+    if (style.hasFlowFrom())
+        list->append(cssValuePool.createValue(style.regionThread(), CSSPrimitiveValue::CSS_STRING));
     return list;
 }
 
-static Ref<CSSValue> counterToCSSValue(const RenderStyle* style, CSSPropertyID propertyID)
+static Ref<CSSValue> counterToCSSValue(const RenderStyle& style, CSSPropertyID propertyID)
 {
-    const CounterDirectiveMap* map = style->counterDirectives();
+    auto* map = style.counterDirectives();
     if (!map)
         return CSSValuePool::singleton().createIdentifierValue(CSSValueNone);
 
@@ -1883,14 +1881,21 @@ static void logUnimplementedPropertyID(CSSPropertyID propertyID)
     LOG_ERROR("WebKit does not yet implement getComputedStyle for '%s'.", getPropertyName(propertyID));
 }
 
-static Ref<CSSValueList> fontFamilyFromStyle(const RenderStyle* style)
+static Ref<CSSValueList> fontFamilyListFromStyle(const RenderStyle& style)
 {
     auto list = CSSValueList::createCommaSeparated();
-    for (unsigned i = 0; i < style->fontCascade().familyCount(); ++i)
-        list.get().append(valueForFamily(style->fontCascade().familyAt(i)));
+    for (unsigned i = 0; i < style.fontCascade().familyCount(); ++i)
+        list->append(valueForFamily(style.fontCascade().familyAt(i)));
     return list;
 }
 
+static Ref<CSSValue> fontFamilyFromStyle(const RenderStyle& style)
+{
+    if (style.fontCascade().familyCount() == 1)
+        return valueForFamily(style.fontCascade().familyAt(0));
+    return fontFamilyListFromStyle(style);
+}
+
 static Ref<CSSPrimitiveValue> lineHeightFromStyle(const RenderStyle& style)
 {
     Length length = style.lineHeight();
@@ -1911,203 +1916,203 @@ static Ref<CSSPrimitiveValue> fontSizeFromStyle(const RenderStyle& style)
     return zoomAdjustedPixelValue(style.fontDescription().computedSize(), style);
 }
 
-static Ref<CSSPrimitiveValue> fontStyleFromStyle(const RenderStyle* style)
+static Ref<CSSPrimitiveValue> fontStyleFromStyle(const RenderStyle& style)
 {
-    if (style->fontDescription().italic())
+    if (style.fontDescription().italic())
         return CSSValuePool::singleton().createIdentifierValue(CSSValueItalic);
     return CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
 }
 
-static Ref<CSSValue> fontVariantFromStyle(const RenderStyle* style)
+static Ref<CSSValue> fontVariantFromStyle(const RenderStyle& style)
 {
-    if (style->fontDescription().variantSettings().isAllNormal())
+    if (style.fontDescription().variantSettings().isAllNormal())
         return CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
 
     auto list = CSSValueList::createSpaceSeparated();
 
-    switch (style->fontDescription().variantCommonLigatures()) {
+    switch (style.fontDescription().variantCommonLigatures()) {
     case FontVariantLigatures::Normal:
         break;
     case FontVariantLigatures::Yes:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueCommonLigatures));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueCommonLigatures));
         break;
     case FontVariantLigatures::No:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoCommonLigatures));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoCommonLigatures));
         break;
     }
 
-    switch (style->fontDescription().variantDiscretionaryLigatures()) {
+    switch (style.fontDescription().variantDiscretionaryLigatures()) {
     case FontVariantLigatures::Normal:
         break;
     case FontVariantLigatures::Yes:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueDiscretionaryLigatures));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueDiscretionaryLigatures));
         break;
     case FontVariantLigatures::No:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoDiscretionaryLigatures));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoDiscretionaryLigatures));
         break;
     }
 
-    switch (style->fontDescription().variantHistoricalLigatures()) {
+    switch (style.fontDescription().variantHistoricalLigatures()) {
     case FontVariantLigatures::Normal:
         break;
     case FontVariantLigatures::Yes:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueHistoricalLigatures));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueHistoricalLigatures));
         break;
     case FontVariantLigatures::No:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoHistoricalLigatures));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoHistoricalLigatures));
         break;
     }
 
-    switch (style->fontDescription().variantContextualAlternates()) {
+    switch (style.fontDescription().variantContextualAlternates()) {
     case FontVariantLigatures::Normal:
         break;
     case FontVariantLigatures::Yes:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueContextual));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueContextual));
         break;
     case FontVariantLigatures::No:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoContextual));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueNoContextual));
         break;
     }
 
-    switch (style->fontDescription().variantPosition()) {
+    switch (style.fontDescription().variantPosition()) {
     case FontVariantPosition::Normal:
         break;
     case FontVariantPosition::Subscript:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSub));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueSub));
         break;
     case FontVariantPosition::Superscript:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSuper));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueSuper));
         break;
     }
 
-    switch (style->fontDescription().variantCaps()) {
+    switch (style.fontDescription().variantCaps()) {
     case FontVariantCaps::Normal:
         break;
     case FontVariantCaps::Small:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSmallCaps));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueSmallCaps));
         break;
     case FontVariantCaps::AllSmall:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueAllSmallCaps));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueAllSmallCaps));
         break;
     case FontVariantCaps::Petite:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValuePetiteCaps));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValuePetiteCaps));
         break;
     case FontVariantCaps::AllPetite:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueAllPetiteCaps));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueAllPetiteCaps));
         break;
     case FontVariantCaps::Unicase:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueUnicase));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueUnicase));
         break;
     case FontVariantCaps::Titling:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueTitlingCaps));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueTitlingCaps));
         break;
     }
 
-    switch (style->fontDescription().variantNumericFigure()) {
+    switch (style.fontDescription().variantNumericFigure()) {
     case FontVariantNumericFigure::Normal:
         break;
     case FontVariantNumericFigure::LiningNumbers:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueLiningNums));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueLiningNums));
         break;
     case FontVariantNumericFigure::OldStyleNumbers:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueOldstyleNums));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueOldstyleNums));
         break;
     }
 
-    switch (style->fontDescription().variantNumericSpacing()) {
+    switch (style.fontDescription().variantNumericSpacing()) {
     case FontVariantNumericSpacing::Normal:
         break;
     case FontVariantNumericSpacing::ProportionalNumbers:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueProportionalNums));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueProportionalNums));
         break;
     case FontVariantNumericSpacing::TabularNumbers:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueTabularNums));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueTabularNums));
         break;
     }
 
-    switch (style->fontDescription().variantNumericFraction()) {
+    switch (style.fontDescription().variantNumericFraction()) {
     case FontVariantNumericFraction::Normal:
         break;
     case FontVariantNumericFraction::DiagonalFractions:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueDiagonalFractions));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueDiagonalFractions));
         break;
     case FontVariantNumericFraction::StackedFractions:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueStackedFractions));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueStackedFractions));
         break;
     }
 
-    switch (style->fontDescription().variantNumericOrdinal()) {
+    switch (style.fontDescription().variantNumericOrdinal()) {
     case FontVariantNumericOrdinal::Normal:
         break;
     case FontVariantNumericOrdinal::Yes:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueOrdinal));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueOrdinal));
         break;
     }
 
-    switch (style->fontDescription().variantNumericSlashedZero()) {
+    switch (style.fontDescription().variantNumericSlashedZero()) {
     case FontVariantNumericSlashedZero::Normal:
         break;
     case FontVariantNumericSlashedZero::Yes:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSlashedZero));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueSlashedZero));
         break;
     }
 
-    switch (style->fontDescription().variantAlternates()) {
+    switch (style.fontDescription().variantAlternates()) {
     case FontVariantAlternates::Normal:
         break;
     case FontVariantAlternates::HistoricalForms:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueHistoricalForms));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueHistoricalForms));
         break;
     }
 
-    switch (style->fontDescription().variantEastAsianVariant()) {
+    switch (style.fontDescription().variantEastAsianVariant()) {
     case FontVariantEastAsianVariant::Normal:
         break;
     case FontVariantEastAsianVariant::Jis78:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis78));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis78));
         break;
     case FontVariantEastAsianVariant::Jis83:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis83));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis83));
         break;
     case FontVariantEastAsianVariant::Jis90:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis90));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis90));
         break;
     case FontVariantEastAsianVariant::Jis04:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis04));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueJis04));
         break;
     case FontVariantEastAsianVariant::Simplified:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSimplified));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueSimplified));
         break;
     case FontVariantEastAsianVariant::Traditional:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueTraditional));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueTraditional));
         break;
     }
 
-    switch (style->fontDescription().variantEastAsianWidth()) {
+    switch (style.fontDescription().variantEastAsianWidth()) {
     case FontVariantEastAsianWidth::Normal:
         break;
     case FontVariantEastAsianWidth::Full:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueFullWidth));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueFullWidth));
         break;
     case FontVariantEastAsianWidth::Proportional:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueProportionalWidth));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueProportionalWidth));
         break;
     }
 
-    switch (style->fontDescription().variantEastAsianRuby()) {
+    switch (style.fontDescription().variantEastAsianRuby()) {
     case FontVariantEastAsianRuby::Normal:
         break;
     case FontVariantEastAsianRuby::Yes:
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueRuby));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueRuby));
         break;
     }
 
     return WTFMove(list);
 }
 
-static Ref<CSSPrimitiveValue> fontWeightFromStyle(const RenderStyle* style)
+static Ref<CSSPrimitiveValue> fontWeightFromStyle(const RenderStyle& style)
 {
-    switch (style->fontDescription().weight()) {
+    switch (style.fontDescription().weight()) {
     case FontWeight100:
         return CSSValuePool::singleton().createIdentifierValue(CSSValue100);
     case FontWeight200:
@@ -2138,19 +2143,19 @@ static Ref<CSSValue> fontSynthesisFromStyle(const RenderStyle& style)
 
     auto list = CSSValueList::createSpaceSeparated();
     if (style.fontDescription().fontSynthesis() & FontSynthesisStyle)
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueStyle));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueStyle));
     if (style.fontDescription().fontSynthesis() & FontSynthesisWeight)
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueWeight));
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueWeight));
     if (style.fontDescription().fontSynthesis() & FontSynthesisSmallCaps)
-        list.get().append(CSSValuePool::singleton().createIdentifierValue(CSSValueSmallCaps));
-    return Ref<CSSValue>(list.get());
+        list->append(CSSValuePool::singleton().createIdentifierValue(CSSValueSmallCaps));
+    return WTFMove(list);
 }
 
 typedef const Length& (RenderStyle::*RenderStyleLengthGetter)() const;
 typedef LayoutUnit (RenderBoxModelObject::*RenderBoxComputedCSSValueGetter)() const;
 
 template<RenderStyleLengthGetter lengthGetter, RenderBoxComputedCSSValueGetter computedCSSValueGetter>
-inline RefPtr<CSSValue> zoomAdjustedPaddingOrMarginPixelValue(const RenderStyle& style, RenderObject* renderer)
+static RefPtr<CSSValue> zoomAdjustedPaddingOrMarginPixelValue(const RenderStyle& style, RenderObject* renderer)
 {
     Length unzoomzedLength = (style.*lengthGetter)();
     if (!is<RenderBox>(renderer) || unzoomzedLength.isFixed())
@@ -2159,11 +2164,9 @@ inline RefPtr<CSSValue> zoomAdjustedPaddingOrMarginPixelValue(const RenderStyle&
 }
 
 template<RenderStyleLengthGetter lengthGetter>
-inline bool paddingOrMarginIsRendererDependent(const RenderStyle* style, RenderObject* renderer)
+static bool paddingOrMarginIsRendererDependent(const RenderStyle* style, RenderObject* renderer)
 {
-    if (!renderer || !renderer->isBox())
-        return false;
-    return !(style && (style->*lengthGetter)().isFixed());
+    return renderer && style && renderer->isBox() && !(style->*lengthGetter)().isFixed();
 }
 
 static CSSValueID convertToPageBreak(BreakBetween value)
@@ -2445,11 +2448,11 @@ static Ref<CSSValueList> valueForItemPositionWithOverflowAlignment(const StyleSe
     auto& cssValuePool = CSSValuePool::singleton();
     auto result = CSSValueList::createSpaceSeparated();
     if (data.positionType() == LegacyPosition)
-        result.get().append(cssValuePool.createIdentifierValue(CSSValueLegacy));
-    result.get().append(cssValuePool.createValue(data.position()));
+        result->append(cssValuePool.createIdentifierValue(CSSValueLegacy));
+    result->append(cssValuePool.createValue(data.position()));
     if (data.position() >= ItemPositionCenter && data.overflow() != OverflowAlignmentDefault)
-        result.get().append(cssValuePool.createValue(data.overflow()));
-    ASSERT(result.get().length() <= 2);
+        result->append(cssValuePool.createValue(data.overflow()));
+    ASSERT(result->length() <= 2);
     return result;
 }
 
@@ -2458,21 +2461,21 @@ static Ref<CSSValueList> valueForContentPositionAndDistributionWithOverflowAlign
     auto& cssValuePool = CSSValuePool::singleton();
     auto result = CSSValueList::createSpaceSeparated();
     if (data.distribution() != ContentDistributionDefault)
-        result.get().append(cssValuePool.createValue(data.distribution()));
+        result->append(cssValuePool.createValue(data.distribution()));
     if (data.distribution() == ContentDistributionDefault || data.position() != ContentPositionNormal) {
         bool gridEnabled = false;
 #if ENABLE(CSS_GRID_LAYOUT)
         gridEnabled = RuntimeEnabledFeatures::sharedFeatures().isCSSGridLayoutEnabled();
 #endif
         if (data.position() != ContentPositionNormal || gridEnabled)
-            result.get().append(cssValuePool.createValue(data.position()));
+            result->append(cssValuePool.createValue(data.position()));
         else
-            result.get().append(cssValuePool.createIdentifierValue(normalBehaviorValueID));
+            result->append(cssValuePool.createIdentifierValue(normalBehaviorValueID));
     }
     if ((data.position() >= ContentPositionCenter || data.distribution() != ContentDistributionDefault) && data.overflow() != OverflowAlignmentDefault)
-        result.get().append(cssValuePool.createValue(data.overflow()));
-    ASSERT(result.get().length() > 0);
-    ASSERT(result.get().length() <= 3);
+        result->append(cssValuePool.createValue(data.overflow()));
+    ASSERT(result->length() > 0);
+    ASSERT(result->length() <= 3);
     return result;
 }
 
@@ -2494,10 +2497,10 @@ RefPtr<CSSValue> ComputedStyleExtractor::customPropertyValue(const String& prope
 
     std::unique_ptr<RenderStyle> ownedStyle;
     auto* style = computeRenderStyleForProperty(*styledElement, m_pseudoElementSpecifier, CSSPropertyCustom, ownedStyle);
-    if (!style || !style->hasCustomProperty(propertyName))
+    if (!style)
         return nullptr;
 
-    return style->getCustomPropertyValue(propertyName);
+    return style->customProperties().get(propertyName);
 }
 
 String ComputedStyleExtractor::customPropertyText(const String& propertyName)
@@ -2560,88 +2563,69 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             return cssValuePool.createColorValue(m_allowVisitedStyle? style->visitedDependentColor(CSSPropertyBackgroundColor) : style->backgroundColor());
         case CSSPropertyBackgroundImage:
         case CSSPropertyWebkitMaskImage: {
-            const FillLayer* layers = propertyID == CSSPropertyWebkitMaskImage ? style->maskLayers() : style->backgroundLayers();
-            if (!layers)
-                return cssValuePool.createIdentifierValue(CSSValueNone);
-
-            if (!layers->next()) {
-                if (layers->image())
-                    return layers->image()->cssValue();
-
+            auto& layers = propertyID == CSSPropertyWebkitMaskImage ? style->maskLayers() : style->backgroundLayers();
+            if (!layers.next()) {
+                if (layers.image())
+                    return layers.image()->cssValue();
                 return cssValuePool.createIdentifierValue(CSSValueNone);
             }
-
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
+            auto list = CSSValueList::createCommaSeparated();
+            for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next()) {
                 if (currLayer->image())
                     list->append(currLayer->image()->cssValue());
                 else
                     list->append(cssValuePool.createIdentifierValue(CSSValueNone));
             }
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyBackgroundSize:
         case CSSPropertyWebkitBackgroundSize:
         case CSSPropertyWebkitMaskSize: {
-            const FillLayer* layers = propertyID == CSSPropertyWebkitMaskSize ? style->maskLayers() : style->backgroundLayers();
-            if (!layers->next())
-                return fillSizeToCSSValue(layers->size(), *style);
-
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+            auto& layers = propertyID == CSSPropertyWebkitMaskSize ? style->maskLayers() : style->backgroundLayers();
+            if (!layers.next())
+                return fillSizeToCSSValue(layers.size(), *style);
+            auto list = CSSValueList::createCommaSeparated();
+            for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next())
                 list->append(fillSizeToCSSValue(currLayer->size(), *style));
-
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyBackgroundRepeat:
         case CSSPropertyWebkitMaskRepeat: {
-            const FillLayer* layers = propertyID == CSSPropertyWebkitMaskRepeat ? style->maskLayers() : style->backgroundLayers();
-            if (!layers->next())
-                return fillRepeatToCSSValue(layers->repeatX(), layers->repeatY());
-
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+            auto& layers = propertyID == CSSPropertyWebkitMaskRepeat ? style->maskLayers() : style->backgroundLayers();
+            if (!layers.next())
+                return fillRepeatToCSSValue(layers.repeatX(), layers.repeatY());
+            auto list = CSSValueList::createCommaSeparated();
+            for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next())
                 list->append(fillRepeatToCSSValue(currLayer->repeatX(), currLayer->repeatY()));
-
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyWebkitMaskSourceType: {
-            const FillLayer* layers = style->maskLayers();
-
-            if (!layers)
-                return cssValuePool.createIdentifierValue(CSSValueNone);
-
-            if (!layers->next())
-                return fillSourceTypeToCSSValue(layers->maskSourceType());
-
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+            auto& layers = style->maskLayers();
+            if (!layers.next())
+                return fillSourceTypeToCSSValue(layers.maskSourceType());
+            auto list = CSSValueList::createCommaSeparated();
+            for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next())
                 list->append(fillSourceTypeToCSSValue(currLayer->maskSourceType()));
-
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyWebkitBackgroundComposite:
         case CSSPropertyWebkitMaskComposite: {
-            const FillLayer* layers = propertyID == CSSPropertyWebkitMaskComposite ? style->maskLayers() : style->backgroundLayers();
-            if (!layers->next())
-                return cssValuePool.createValue(layers->composite());
-
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+            auto& layers = propertyID == CSSPropertyWebkitMaskComposite ? style->maskLayers() : style->backgroundLayers();
+            if (!layers.next())
+                return cssValuePool.createValue(layers.composite());
+            auto list = CSSValueList::createCommaSeparated();
+            for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next())
                 list->append(cssValuePool.createValue(currLayer->composite()));
-
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyBackgroundAttachment: {
-            const FillLayer* layers = style->backgroundLayers();
-            if (!layers->next())
-                return cssValuePool.createValue(layers->attachment());
-
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+            auto& layers = style->backgroundLayers();
+            if (!layers.next())
+                return cssValuePool.createValue(layers.attachment());
+            auto list = CSSValueList::createCommaSeparated();
+            for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next())
                 list->append(cssValuePool.createValue(currLayer->attachment()));
-
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyBackgroundClip:
         case CSSPropertyBackgroundOrigin:
@@ -2649,65 +2633,59 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
         case CSSPropertyWebkitBackgroundOrigin:
         case CSSPropertyWebkitMaskClip:
         case CSSPropertyWebkitMaskOrigin: {
-            const FillLayer* layers = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? style->maskLayers() : style->backgroundLayers();
+            auto& layers = (propertyID == CSSPropertyWebkitMaskClip || propertyID == CSSPropertyWebkitMaskOrigin) ? style->maskLayers() : style->backgroundLayers();
             bool isClip = propertyID == CSSPropertyBackgroundClip || propertyID == CSSPropertyWebkitBackgroundClip || propertyID == CSSPropertyWebkitMaskClip;
-            if (!layers->next()) {
-                EFillBox box = isClip ? layers->clip() : layers->origin();
-                return cssValuePool.createValue(box);
-            }
-
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next()) {
-                EFillBox box = isClip ? currLayer->clip() : currLayer->origin();
-                list->append(cssValuePool.createValue(box));
-            }
-
-            return list;
+            if (!layers.next())
+                return cssValuePool.createValue(isClip ? layers.clip() : layers.origin());
+            auto list = CSSValueList::createCommaSeparated();
+            for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next())
+                list->append(cssValuePool.createValue(isClip ? currLayer->clip() : currLayer->origin()));
+            return WTFMove(list);
         }
         case CSSPropertyBackgroundPosition:
         case CSSPropertyWebkitMaskPosition: {
-            const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPosition ? style->maskLayers() : style->backgroundLayers();
-            if (!layers->next())
+            auto& layers = propertyID == CSSPropertyWebkitMaskPosition ? style->maskLayers() : style->backgroundLayers();
+            if (!layers.next())
                 return createPositionListForLayer(propertyID, layers, *style);
 
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
-                list->append(createPositionListForLayer(propertyID, currLayer, *style));
-            return list;
+            auto list = CSSValueList::createCommaSeparated();
+            for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next())
+                list->append(createPositionListForLayer(propertyID, *currLayer, *style));
+            return WTFMove(list);
         }
         case CSSPropertyBackgroundPositionX:
         case CSSPropertyWebkitMaskPositionX: {
-            const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionX ? style->maskLayers() : style->backgroundLayers();
-            if (!layers->next())
-                return cssValuePool.createValue(layers->xPosition());
+            auto& layers = propertyID == CSSPropertyWebkitMaskPositionX ? style->maskLayers() : style->backgroundLayers();
+            if (!layers.next())
+                return cssValuePool.createValue(layers.xPosition());
 
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+            auto list = CSSValueList::createCommaSeparated();
+            for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next())
                 list->append(cssValuePool.createValue(currLayer->xPosition()));
 
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyBackgroundPositionY:
         case CSSPropertyWebkitMaskPositionY: {
-            const FillLayer* layers = propertyID == CSSPropertyWebkitMaskPositionY ? style->maskLayers() : style->backgroundLayers();
-            if (!layers->next())
-                return cssValuePool.createValue(layers->yPosition());
+            auto& layers = propertyID == CSSPropertyWebkitMaskPositionY ? style->maskLayers() : style->backgroundLayers();
+            if (!layers.next())
+                return cssValuePool.createValue(layers.yPosition());
 
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+            auto list = CSSValueList::createCommaSeparated();
+            for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next())
                 list->append(cssValuePool.createValue(currLayer->yPosition()));
 
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyBorderCollapse:
             if (style->borderCollapse())
                 return cssValuePool.createIdentifierValue(CSSValueCollapse);
             return cssValuePool.createIdentifierValue(CSSValueSeparate);
         case CSSPropertyBorderSpacing: {
-            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+            auto list = CSSValueList::createSpaceSeparated();
             list->append(zoomAdjustedPixelValue(style->horizontalBorderSpacing(), *style));
             list->append(zoomAdjustedPixelValue(style->verticalBorderSpacing(), *style));
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyWebkitBorderHorizontalSpacing:
             return zoomAdjustedPixelValue(style->horizontalBorderSpacing(), *style);
@@ -2822,7 +2800,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
 #endif
         case CSSPropertyCursor: {
             RefPtr<CSSValueList> list;
-            CursorList* cursors = style->cursors();
+            auto* cursors = style->cursors();
             if (cursors && cursors->size() > 0) {
                 list = CSSValueList::createCommaSeparated();
                 for (unsigned i = 0; i < cursors->size(); ++i)
@@ -2881,59 +2859,53 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
                 return cssValuePool.createIdentifierValue(CSSValueNone);
             return cssValuePool.createValue(style->floating());
         case CSSPropertyFont: {
-            RefPtr<CSSFontValue> computedFont = CSSFontValue::create();
-            computedFont->style = fontStyleFromStyle(style);
+            auto computedFont = CSSFontValue::create();
+            computedFont->style = fontStyleFromStyle(*style);
             if (style->fontDescription().variantCaps() == FontVariantCaps::Small)
                 computedFont->variant = CSSValuePool::singleton().createIdentifierValue(CSSValueSmallCaps);
             else
                 computedFont->variant = CSSValuePool::singleton().createIdentifierValue(CSSValueNormal);
-            computedFont->weight = fontWeightFromStyle(style);
+            computedFont->weight = fontWeightFromStyle(*style);
             computedFont->size = fontSizeFromStyle(*style);
             computedFont->lineHeight = lineHeightFromStyle(*style);
-            computedFont->family = fontFamilyFromStyle(style);
-            return computedFont;
-        }
-        case CSSPropertyFontFamily: {
-            RefPtr<CSSValueList> fontFamilyList = fontFamilyFromStyle(style);
-            // If there's only a single family, return that as a CSSPrimitiveValue.
-            // NOTE: Gecko always returns this as a comma-separated CSSPrimitiveValue string.
-            if (fontFamilyList->length() == 1)
-                return fontFamilyList->item(0);
-            return fontFamilyList;
+            computedFont->family = fontFamilyListFromStyle(*style);
+            return WTFMove(computedFont);
         }
+        case CSSPropertyFontFamily:
+            return fontFamilyFromStyle(*style);
         case CSSPropertyFontSize:
             return fontSizeFromStyle(*style);
         case CSSPropertyFontStyle:
-            return fontStyleFromStyle(style);
+            return fontStyleFromStyle(*style);
         case CSSPropertyFontVariant:
-            return fontVariantFromStyle(style);
+            return fontVariantFromStyle(*style);
         case CSSPropertyFontWeight:
-            return fontWeightFromStyle(style);
+            return fontWeightFromStyle(*style);
         case CSSPropertyFontSynthesis:
             return fontSynthesisFromStyle(*style);
         case CSSPropertyFontFeatureSettings: {
             const FontFeatureSettings& featureSettings = style->fontDescription().featureSettings();
             if (!featureSettings.size())
                 return cssValuePool.createIdentifierValue(CSSValueNormal);
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+            auto list = CSSValueList::createCommaSeparated();
             for (auto& feature : featureSettings)
                 list->append(CSSFontFeatureValue::create(FontTag(feature.tag()), feature.value()));
-            return list;
+            return WTFMove(list);
         }
 #if ENABLE(VARIATION_FONTS)
         case CSSPropertyFontVariationSettings: {
             const FontVariationSettings& variationSettings = style->fontDescription().variationSettings();
             if (variationSettings.isEmpty())
                 return cssValuePool.createIdentifierValue(CSSValueNormal);
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+            auto list = CSSValueList::createCommaSeparated();
             for (auto& feature : variationSettings)
                 list->append(CSSFontVariationValue::create(feature.tag(), feature.value()));
-            return list;
+            return WTFMove(list);
         }
 #endif
 #if ENABLE(CSS_GRID_LAYOUT)
         case CSSPropertyGridAutoFlow: {
-            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+            auto list = CSSValueList::createSpaceSeparated();
             ASSERT(style->isGridAutoFlowDirectionRow() || style->isGridAutoFlowDirectionColumn());
             if (style->isGridAutoFlowDirectionRow())
                 list->append(cssValuePool.createIdentifierValue(CSSValueRow));
@@ -2943,7 +2915,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             if (style->isGridAutoFlowAlgorithmDense())
                 list->append(cssValuePool.createIdentifierValue(CSSValueDense));
 
-            return list;
+            return WTFMove(list);
         }
 
         // Specs mention that getComputedStyle() should return the used value of the property instead of the computed
@@ -2979,13 +2951,11 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             return getCSSPropertyValuesForGridShorthand(gridColumnShorthand());
         case CSSPropertyGridRow:
             return getCSSPropertyValuesForGridShorthand(gridRowShorthand());
-
         case CSSPropertyGridTemplateAreas:
             if (!style->namedGridAreaRowCount()) {
                 ASSERT(!style->namedGridAreaColumnCount());
                 return cssValuePool.createIdentifierValue(CSSValueNone);
             }
-
             return CSSGridTemplateAreasValue::create(style->namedGridArea(), style->namedGridAreaRowCount(), style->namedGridAreaColumnCount());
         case CSSPropertyGridColumnGap:
             return zoomAdjustedPixelValueForLength(style->gridColumnGap(), *style);
@@ -3120,10 +3090,10 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
         case CSSPropertyObjectFit:
             return cssValuePool.createValue(style->objectFit());
         case CSSPropertyObjectPosition: {
-            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+            auto list = CSSValueList::createSpaceSeparated();
             list->append(zoomAdjustedPixelValueForLength(style->objectPosition().x(), *style));
             list->append(zoomAdjustedPixelValueForLength(style->objectPosition().y(), *style));
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyOpacity:
             return cssValuePool.createValue(style->opacity(), CSSPrimitiveValue::CSS_NUMBER);
@@ -3224,31 +3194,30 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             case TextEmphasisMarkCircle:
             case TextEmphasisMarkDoubleCircle:
             case TextEmphasisMarkTriangle:
-            case TextEmphasisMarkSesame: {
-                RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+            case TextEmphasisMarkSesame:
+                auto list = CSSValueList::createSpaceSeparated();
                 list->append(cssValuePool.createValue(style->textEmphasisFill()));
                 list->append(cssValuePool.createValue(style->textEmphasisMark()));
-                return list;
-            }
+                return WTFMove(list);
             }
         case CSSPropertyTextIndent: {
             // If CSS3_TEXT is disabled or text-indent has only one value(<length> | <percentage>),
             // getPropertyCSSValue() returns CSSValue.
-            RefPtr<CSSValue> textIndent = zoomAdjustedPixelValueForLength(style->textIndent(), *style);
+            auto textIndent = zoomAdjustedPixelValueForLength(style->textIndent(), *style);
 #if ENABLE(CSS3_TEXT)
             // If CSS3_TEXT is enabled and text-indent has -webkit-each-line or -webkit-hanging,
             // getPropertyCSSValue() returns CSSValueList.
             if (style->textIndentLine() == TextIndentEachLine || style->textIndentType() == TextIndentHanging) {
-                RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-                list->append(textIndent.releaseNonNull());
+                auto list = CSSValueList::createSpaceSeparated();
+                list->append(WTFMove(textIndent));
                 if (style->textIndentLine() == TextIndentEachLine)
                     list->append(cssValuePool.createIdentifierValue(CSSValueWebkitEachLine));
                 if (style->textIndentType() == TextIndentHanging)
                     list->append(cssValuePool.createIdentifierValue(CSSValueWebkitHanging));
-                return list;
+                return WTFMove(list);
             }
 #endif
-            return textIndent;
+            return WTFMove(textIndent);
         }
         case CSSPropertyTextShadow:
             return valueForShadow(style->textShadow(), propertyID, *style);
@@ -3321,8 +3290,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             }
             return zoomAdjustedPixelValueForLength(style->width(), *style);
         case CSSPropertyWillChange:
-            return getWillChangePropertyValue(style->willChange());
-            break;
+            return willChangePropertyValue(style->willChange());
         case CSSPropertyWordBreak:
             return cssValuePool.createValue(style->wordBreak());
         case CSSPropertyWordSpacing:
@@ -3394,9 +3362,9 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
         }
 #endif
         case CSSPropertyAnimationDelay:
-            return getDelayValue(style->animations());
+            return delayValue(style->animations());
         case CSSPropertyAnimationDirection: {
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+            auto list = CSSValueList::createCommaSeparated();
             const AnimationList* t = style->animations();
             if (t) {
                 for (size_t i = 0; i < t->size(); ++i) {
@@ -3417,12 +3385,12 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
                 }
             } else
                 list->append(cssValuePool.createIdentifierValue(CSSValueNormal));
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyAnimationDuration:
-            return getDurationValue(style->animations());
+            return durationValue(style->animations());
         case CSSPropertyAnimationFillMode: {
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+            auto list = CSSValueList::createCommaSeparated();
             const AnimationList* t = style->animations();
             if (t) {
                 for (size_t i = 0; i < t->size(); ++i) {
@@ -3443,10 +3411,10 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
                 }
             } else
                 list->append(cssValuePool.createIdentifierValue(CSSValueNone));
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyAnimationIterationCount: {
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+            auto list = CSSValueList::createCommaSeparated();
             const AnimationList* t = style->animations();
             if (t) {
                 for (size_t i = 0; i < t->size(); ++i) {
@@ -3458,20 +3426,20 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
                 }
             } else
                 list->append(cssValuePool.createValue(Animation::initialIterationCount(), CSSPrimitiveValue::CSS_NUMBER));
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyAnimationName: {
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+            auto list = CSSValueList::createCommaSeparated();
             const AnimationList* t = style->animations();
             if (t) {
                 for (size_t i = 0; i < t->size(); ++i)
                     list->append(cssValuePool.createValue(t->animation(i).name(), CSSPrimitiveValue::CSS_STRING));
             } else
                 list->append(cssValuePool.createIdentifierValue(CSSValueNone));
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyAnimationPlayState: {
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
+            auto list = CSSValueList::createCommaSeparated();
             const AnimationList* t = style->animations();
             if (t) {
                 for (size_t i = 0; i < t->size(); ++i) {
@@ -3483,13 +3451,13 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
                 }
             } else
                 list->append(cssValuePool.createIdentifierValue(CSSValueRunning));
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyAnimationTimingFunction:
-            return getTimingFunctionValue(style->animations());
+            return timingFunctionValue(style->animations());
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
         case CSSPropertyWebkitAnimationTrigger:
-            return getAnimationTriggerValue(style->animations(), *style);
+            return animationTriggerValue(style->animations(), *style);
 #endif
         case CSSPropertyWebkitAppearance:
             return cssValuePool.createValue(style->appearance());
@@ -3531,8 +3499,8 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             // Not a real style property -- used by the editing engine -- so has no computed value.
             break;
         case CSSPropertyWebkitInitialLetter: {
-            Ref<CSSPrimitiveValue> drop = !style->initialLetterDrop() ? cssValuePool.createIdentifierValue(CSSValueNormal) : cssValuePool.createValue(style->initialLetterDrop(), CSSPrimitiveValue::CSS_NUMBER);
-            Ref<CSSPrimitiveValue> size = !style->initialLetterHeight() ? cssValuePool.createIdentifierValue(CSSValueNormal) : cssValuePool.createValue(style->initialLetterHeight(), CSSPrimitiveValue::CSS_NUMBER);
+            auto drop = !style->initialLetterDrop() ? cssValuePool.createIdentifierValue(CSSValueNormal) : cssValuePool.createValue(style->initialLetterDrop(), CSSPrimitiveValue::CSS_NUMBER);
+            auto size = !style->initialLetterHeight() ? cssValuePool.createIdentifierValue(CSSValueNormal) : cssValuePool.createValue(style->initialLetterHeight(), CSSPrimitiveValue::CSS_NUMBER);
             return cssValuePool.createValue(Pair::create(WTFMove(drop), WTFMove(size)));
         }
         case CSSPropertyWebkitMarginBottomCollapse:
@@ -3552,7 +3520,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
                 return cssValuePool.createIdentifierValue(CSSValueNone);
             return zoomAdjustedPixelValue(style->perspective(), *style);
         case CSSPropertyPerspectiveOrigin: {
-            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+            auto list = CSSValueList::createSpaceSeparated();
             if (renderer) {
                 LayoutRect box;
                 if (is<RenderBox>(*renderer))
@@ -3566,7 +3534,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
                 list->append(zoomAdjustedPixelValueForLength(style->perspectiveOriginY(), *style));
 
             }
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyWebkitRtlOrdering:
             return cssValuePool.createIdentifierValue(style->rtlOrdering() ? CSSValueVisual : CSSValueLogical);
@@ -3585,13 +3553,13 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
         case CSSPropertyWebkitUserSelect:
             return cssValuePool.createValue(style->userSelect());
         case CSSPropertyBorderBottomLeftRadius:
-            return getBorderRadiusCornerValue(style->borderBottomLeftRadius(), *style);
+            return borderRadiusCornerValue(style->borderBottomLeftRadius(), *style);
         case CSSPropertyBorderBottomRightRadius:
-            return getBorderRadiusCornerValue(style->borderBottomRightRadius(), *style);
+            return borderRadiusCornerValue(style->borderBottomRightRadius(), *style);
         case CSSPropertyBorderTopLeftRadius:
-            return getBorderRadiusCornerValue(style->borderTopLeftRadius(), *style);
+            return borderRadiusCornerValue(style->borderTopLeftRadius(), *style);
         case CSSPropertyBorderTopRightRadius:
-            return getBorderRadiusCornerValue(style->borderTopRightRadius(), *style);
+            return borderRadiusCornerValue(style->borderTopRightRadius(), *style);
         case CSSPropertyClip: {
             if (!style->hasClip())
                 return cssValuePool.createIdentifierValue(CSSValueAuto);
@@ -3607,7 +3575,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
         case CSSPropertyTransform:
             return computedTransform(renderer, *style);
         case CSSPropertyTransformOrigin: {
-            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+            auto list = CSSValueList::createSpaceSeparated();
             if (renderer) {
                 LayoutRect box;
                 if (is<RenderBox>(*renderer))
@@ -3623,42 +3591,41 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
                 if (style->transformOriginZ() != 0)
                     list->append(zoomAdjustedPixelValue(style->transformOriginZ(), *style));
             }
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyTransformStyle:
         case CSSPropertyWebkitTransformStyle:
             return cssValuePool.createIdentifierValue((style->transformStyle3D() == TransformStyle3DPreserve3D) ? CSSValuePreserve3d : CSSValueFlat);
         case CSSPropertyTransitionDelay:
-            return getDelayValue(style->transitions());
+            return delayValue(style->transitions());
         case CSSPropertyTransitionDuration:
-            return getDurationValue(style->transitions());
+            return durationValue(style->transitions());
         case CSSPropertyTransitionProperty:
-            return getTransitionPropertyValue(style->transitions());
+            return transitionPropertyValue(style->transitions());
         case CSSPropertyTransitionTimingFunction:
-            return getTimingFunctionValue(style->transitions());
+            return timingFunctionValue(style->transitions());
         case CSSPropertyTransition: {
-            const AnimationList* animList = style->transitions();
-            if (animList) {
-                RefPtr<CSSValueList> transitionsList = CSSValueList::createCommaSeparated();
-                for (size_t i = 0; i < animList->size(); ++i) {
-                    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-                    const Animation& animation = animList->animation(i);
+            if (auto* animationList = style->transitions()) {
+                auto transitionsList = CSSValueList::createCommaSeparated();
+                for (size_t i = 0; i < animationList->size(); ++i) {
+                    auto list = CSSValueList::createSpaceSeparated();
+                    auto& animation = animationList->animation(i);
                     list->append(createTransitionPropertyValue(animation));
                     list->append(cssValuePool.createValue(animation.duration(), CSSPrimitiveValue::CSS_S));
-                    list->append(createTimingFunctionValue(animation.timingFunction().get()));
+                    list->append(createTimingFunctionValue(*animation.timingFunction()));
                     list->append(cssValuePool.createValue(animation.delay(), CSSPrimitiveValue::CSS_S));
-                    transitionsList->append(list.releaseNonNull());
+                    transitionsList->append(WTFMove(list));
                 }
-                return transitionsList;
+                return WTFMove(transitionsList);
             }
 
-            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+            auto list = CSSValueList::createSpaceSeparated();
             // transition-property default value.
             list->append(cssValuePool.createIdentifierValue(CSSValueAll));
             list->append(cssValuePool.createValue(Animation::initialDuration(), CSSPrimitiveValue::CSS_S));
-            list->append(createTimingFunctionValue(Animation::initialTimingFunction().get()));
+            list->append(createTimingFunctionValue(Animation::initialTimingFunction()));
             list->append(cssValuePool.createValue(Animation::initialDelay(), CSSPrimitiveValue::CSS_S));
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyPointerEvents:
             return cssValuePool.createValue(style->pointerEvents());
@@ -3679,33 +3646,29 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
         case CSSPropertyWebkitLineBoxContain:
             return createLineBoxContainValue(style->lineBoxContain());
         case CSSPropertyAlt:
-            return altTextToCSSValue(style);
+            return altTextToCSSValue(*style);
         case CSSPropertyContent:
-            return contentToCSSValue(style);
+            return contentToCSSValue(*style);
         case CSSPropertyCounterIncrement:
-            return counterToCSSValue(style, propertyID);
+            return counterToCSSValue(*style, propertyID);
         case CSSPropertyCounterReset:
-            return counterToCSSValue(style, propertyID);
+            return counterToCSSValue(*style, propertyID);
         case CSSPropertyWebkitClipPath: {
-            ClipPathOperation* operation = style->clipPath();
+            auto* operation = style->clipPath();
             if (!operation)
                 return cssValuePool.createIdentifierValue(CSSValueNone);
-            if (is<ReferenceClipPathOperation>(*operation)) {
-                const auto& referenceOperation = downcast<ReferenceClipPathOperation>(*operation);
-                return CSSPrimitiveValue::create(referenceOperation.url(), CSSPrimitiveValue::CSS_URI);
-            }
-            RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+            if (is<ReferenceClipPathOperation>(*operation))
+                return CSSPrimitiveValue::create(downcast<ReferenceClipPathOperation>(*operation).url(), CSSPrimitiveValue::CSS_URI);
+            auto list = CSSValueList::createSpaceSeparated();
             if (is<ShapeClipPathOperation>(*operation)) {
-                const auto& shapeOperation = downcast<ShapeClipPathOperation>(*operation);
+                auto& shapeOperation = downcast<ShapeClipPathOperation>(*operation);
                 list->append(valueForBasicShape(*style, shapeOperation.basicShape()));
                 if (shapeOperation.referenceBox() != BoxMissing)
                     list->append(cssValuePool.createValue(shapeOperation.referenceBox()));
             }
-            if (is<BoxClipPathOperation>(*operation)) {
-                const auto& boxOperation = downcast<BoxClipPathOperation>(*operation);
-                list->append(cssValuePool.createValue(boxOperation.referenceBox()));
-            }
-            return list;
+            if (is<BoxClipPathOperation>(*operation))
+                list->append(cssValuePool.createValue(downcast<BoxClipPathOperation>(*operation).referenceBox()));
+            return WTFMove(list);
         }
 #if ENABLE(CSS_REGIONS)
         case CSSPropertyWebkitFlowInto:
@@ -3738,20 +3701,18 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
             return cssValuePool.createValue(style->isolation());
 #endif
         case CSSPropertyBackgroundBlendMode: {
-            const FillLayer* layers = style->backgroundLayers();
-            if (!layers->next())
-                return cssValuePool.createValue(layers->blendMode());
-
-            RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
-            for (const FillLayer* currLayer = layers; currLayer; currLayer = currLayer->next())
+            auto& layers = style->backgroundLayers();
+            if (!layers.next())
+                return cssValuePool.createValue(layers.blendMode());
+            auto list = CSSValueList::createCommaSeparated();
+            for (auto* currLayer = &layers; currLayer; currLayer = currLayer->next())
                 list->append(cssValuePool.createValue(currLayer->blendMode()));
-
-            return list;
+            return WTFMove(list);
         }
         case CSSPropertyBackground:
             return getBackgroundShorthandValue();
         case CSSPropertyBorder: {
-            RefPtr<CSSValue> value = propertyValue(CSSPropertyBorderTop, DoNotUpdateLayout);
+            auto value = propertyValue(CSSPropertyBorderTop, DoNotUpdateLayout);
             const CSSPropertyID properties[3] = { CSSPropertyBorderRight, CSSPropertyBorderBottom, CSSPropertyBorderLeft };
             for (auto& property : properties) {
                 if (!compareCSSValuePtr<CSSValue>(value, propertyValue(property, DoNotUpdateLayout)))
@@ -3768,7 +3729,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
         case CSSPropertyBorderImage:
             return valueForNinePieceImage(style->borderImage());
         case CSSPropertyBorderRadius:
-            return getBorderRadiusShorthandValue(*style);
+            return borderRadiusShorthandValue(*style);
         case CSSPropertyBorderRight:
             return getCSSPropertyValuesForShorthandProperties(borderRightShorthand());
         case CSSPropertyBorderStyle:
@@ -3998,7 +3959,7 @@ RefPtr<CSSValue> ComputedStyleExtractor::propertyValue(CSSPropertyID propertyID,
 
 String CSSComputedStyleDeclaration::getPropertyValue(CSSPropertyID propertyID) const
 {
-    RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
+    auto value = getPropertyCSSValue(propertyID);
     if (!value)
         return emptyString(); // FIXME: Should this be null instead, as it is in StyleProperties::getPropertyValue?
     return value->cssText();
@@ -4063,22 +4024,21 @@ Ref<MutableStyleProperties> ComputedStyleExtractor::copyProperties()
 
 RefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForShorthandProperties(const StylePropertyShorthand& shorthand)
 {
-    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
-    for (size_t i = 0; i < shorthand.length(); ++i) {
-        RefPtr<CSSValue> value = propertyValue(shorthand.properties()[i], DoNotUpdateLayout);
-        list->append(value.releaseNonNull());
-    }
-    return list;
+    auto list = CSSValueList::createSpaceSeparated();
+    for (size_t i = 0; i < shorthand.length(); ++i)
+        list->append(propertyValue(shorthand.properties()[i], DoNotUpdateLayout).releaseNonNull());
+    return WTFMove(list);
 }
 
 RefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForSidesShorthand(const StylePropertyShorthand& shorthand)
 {
-    RefPtr<CSSValueList> list = CSSValueList::createSpaceSeparated();
+    auto list = CSSValueList::createSpaceSeparated();
+
     // Assume the properties are in the usual order top, right, bottom, left.
-    RefPtr<CSSValue> topValue = propertyValue(shorthand.properties()[0], DoNotUpdateLayout);
-    RefPtr<CSSValue> rightValue = propertyValue(shorthand.properties()[1], DoNotUpdateLayout);
-    RefPtr<CSSValue> bottomValue = propertyValue(shorthand.properties()[2], DoNotUpdateLayout);
-    RefPtr<CSSValue> leftValue = propertyValue(shorthand.properties()[3], DoNotUpdateLayout);
+    auto topValue = propertyValue(shorthand.properties()[0], DoNotUpdateLayout);
+    auto rightValue = propertyValue(shorthand.properties()[1], DoNotUpdateLayout);
+    auto bottomValue = propertyValue(shorthand.properties()[2], DoNotUpdateLayout);
+    auto leftValue = propertyValue(shorthand.properties()[3], DoNotUpdateLayout);
 
     // All 4 properties must be specified.
     if (!topValue || !rightValue || !bottomValue || !leftValue)
@@ -4096,17 +4056,15 @@ RefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForSidesShortha
     if (showLeft)
         list->append(leftValue.releaseNonNull());
 
-    return list;
+    return WTFMove(list);
 }
 
 RefPtr<CSSValueList> ComputedStyleExtractor::getCSSPropertyValuesForGridShorthand(const StylePropertyShorthand& shorthand)
 {
-    RefPtr<CSSValueList> list = CSSValueList::createSlashSeparated();
-    for (size_t i = 0; i < shorthand.length(); ++i) {
-        RefPtr<CSSValue> value = propertyValue(shorthand.properties()[i], DoNotUpdateLayout);
-        list->append(value.releaseNonNull());
-    }
-    return list;
+    auto list = CSSValueList::createSlashSeparated();
+    for (size_t i = 0; i < shorthand.length(); ++i)
+        list->append(propertyValue(shorthand.properties()[i], DoNotUpdateLayout).releaseNonNull());
+    return WTFMove(list);
 }
 
 Ref<MutableStyleProperties> ComputedStyleExtractor::copyPropertiesInSet(const CSSPropertyID* set, unsigned length)
@@ -4114,8 +4072,7 @@ Ref<MutableStyleProperties> ComputedStyleExtractor::copyPropertiesInSet(const CS
     Vector<CSSProperty, 256> list;
     list.reserveInitialCapacity(length);
     for (unsigned i = 0; i < length; ++i) {
-        auto value = propertyValue(set[i]);
-        if (value)
+        if (auto value = propertyValue(set[i]))
             list.append(CSSProperty(set[i], WTFMove(value), false));
     }
     return MutableStyleProperties::create(list.data(), list.size());
@@ -4138,7 +4095,7 @@ RefPtr<DeprecatedCSSOMValue> CSSComputedStyleDeclaration::getPropertyCSSValue(co
     CSSPropertyID propertyID = cssPropertyID(propertyName);
     if (!propertyID)
         return nullptr;
-    RefPtr<CSSValue> value = getPropertyCSSValue(propertyID);
+    auto value = getPropertyCSSValue(propertyID);
     if (!value)
         return nullptr;
     return value->createDeprecatedCSSOMWrapper();
index c8b6155..3c7c299 100644 (file)
@@ -45,7 +45,7 @@ class CSSImageGeneratorValue::CachedGeneratedImage {
     WTF_MAKE_FAST_ALLOCATED;
 public:
     CachedGeneratedImage(CSSImageGeneratorValue&, FloatSize, GeneratedImage&);
-    GeneratedImage& image() const { return const_cast<GeneratedImage&>(m_image.get()); }
+    GeneratedImage& image() const { return m_image; }
     void puntEvictionTimer() { m_evictionTimer.restart(); }
 
 private:
index 0642b87..09e7ad3 100644 (file)
@@ -211,12 +211,10 @@ CSSKeyframeRule* CSSKeyframesRule::item(unsigned index) const
 { 
     if (index >= length())
         return nullptr;
-
     ASSERT(m_childRuleCSSOMWrappers.size() == m_keyframesRule->keyframes().size());
-    RefPtr<CSSKeyframeRule>& rule = m_childRuleCSSOMWrappers[index];
+    auto& rule = m_childRuleCSSOMWrappers[index];
     if (!rule)
-        rule = adoptRef(new CSSKeyframeRule(const_cast<StyleRuleKeyframe&>(m_keyframesRule->keyframes()[index].get()), const_cast<CSSKeyframesRule*>(this)));
-
+        rule = adoptRef(*new CSSKeyframeRule(m_keyframesRule->keyframes()[index], const_cast<CSSKeyframesRule*>(this)));
     return rule.get(); 
 }
 
index 20c56e6..482fd3d 100644 (file)
@@ -427,7 +427,7 @@ void CSSPrimitiveValue::init(const LengthSize& lengthSize, const RenderStyle& st
 {
     m_primitiveUnitType = CSS_PAIR;
     m_hasCachedCSSText = false;
-    m_value.pair = &Pair::create(create(lengthSize.width(), style), create(lengthSize.height(), style)).leakRef();
+    m_value.pair = &Pair::create(create(lengthSize.width, style), create(lengthSize.height, style)).leakRef();
 }
 
 void CSSPrimitiveValue::init(Ref<Counter>&& counter)
index 810b9a4..71f3550 100644 (file)
@@ -41,7 +41,7 @@ public:
     WEBCORE_EXPORT CSSStyleDeclaration& style();
 
     // FIXME: Not CSSOM. Remove.
-    StyleRule& styleRule() const { return const_cast<StyleRule&>(m_styleRule.get()); }
+    StyleRule& styleRule() const { return m_styleRule.get(); }
 
 private:
     CSSStyleRule(StyleRule&, CSSStyleSheet*);
index 2a27ddb..85c44a2 100644 (file)
@@ -188,12 +188,11 @@ void CSSToStyleMap::mapFillRepeatY(CSSPropertyID propertyID, FillLayer& layer, c
 static inline bool convertToLengthSize(const CSSPrimitiveValue& primitiveValue, CSSToLengthConversionData conversionData, LengthSize& size)
 {
     if (auto* pair = primitiveValue.pairValue()) {
-        size.setWidth(pair->first()->convertToLength<AnyConversion>(conversionData));
-        size.setHeight(pair->second()->convertToLength<AnyConversion>(conversionData));
+        size.width = pair->first()->convertToLength<AnyConversion>(conversionData);
+        size.height = pair->second()->convertToLength<AnyConversion>(conversionData);
     } else
-        size.setWidth(primitiveValue.convertToLength<AnyConversion>(conversionData));
-
-    return !size.width().isUndefined() && !size.height().isUndefined();
+        size.width = primitiveValue.convertToLength<AnyConversion>(conversionData);
+    return !size.width.isUndefined() && !size.height.isUndefined();
 }
 
 void CSSToStyleMap::mapFillSize(CSSPropertyID propertyID, FillLayer& layer, const CSSValue& value)
index c9fb733..c289f78 100644 (file)
@@ -258,13 +258,13 @@ ExceptionOr<void> FontFace::setFeatureSettings(const String& featureSettings)
 
 String FontFace::family() const
 {
-    const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();
+    m_backing->updateStyleIfNeeded();
     return m_backing->families()->cssText();
 }
 
 String FontFace::style() const
 {
-    const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();
+    m_backing->updateStyleIfNeeded();
     switch (m_backing->traitsMask() & FontStyleMask) {
     case FontStyleNormalMask:
         return String("normal", String::ConstructFromLiteral);
@@ -277,7 +277,7 @@ String FontFace::style() const
 
 String FontFace::weight() const
 {
-    const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();
+    m_backing->updateStyleIfNeeded();
     switch (m_backing->traitsMask() & FontWeightMask) {
     case FontWeight100Mask:
         return String("100", String::ConstructFromLiteral);
@@ -309,7 +309,7 @@ String FontFace::stretch() const
 
 String FontFace::unicodeRange() const
 {
-    const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();
+    m_backing->updateStyleIfNeeded();
     if (!m_backing->ranges().size())
         return ASCIILiteral("U+0-10FFFF");
     RefPtr<CSSValueList> values = CSSValueList::createCommaSeparated();
@@ -320,13 +320,13 @@ String FontFace::unicodeRange() const
 
 String FontFace::variant() const
 {
-    const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();
+    m_backing->updateStyleIfNeeded();
     return computeFontVariant(m_backing->variantSettings())->cssText();
 }
 
 String FontFace::featureSettings() const
 {
-    const_cast<CSSFontFace&>(m_backing.get()).updateStyleIfNeeded();
+    m_backing->updateStyleIfNeeded();
     if (!m_backing->featureSettings().size())
         return ASCIILiteral("normal");
     RefPtr<CSSValueList> list = CSSValueList::createCommaSeparated();
index b21dd5d..68fffde 100644 (file)
@@ -25,6 +25,7 @@
 #include "LengthFunctions.h"
 
 #include "FloatSize.h"
+#include "LayoutSize.h"
 #include "LengthSize.h"
 
 namespace WebCore {
@@ -58,6 +59,11 @@ LayoutUnit valueForLength(const Length& length, LayoutUnit maximumValue)
     return 0;
 }
 
+LayoutSize sizeForLengthSize(const LengthSize& length, const LayoutSize& maximumValue)
+{
+    return { valueForLength(length.width, maximumValue.width()), valueForLength(length.height, maximumValue.height()) };
+}
+
 // FIXME: when subpixel layout is supported this copy of floatValueForLength() can be removed. See bug 71143.
 float floatValueForLength(const Length& length, LayoutUnit maximumValue)
 {
@@ -113,7 +119,7 @@ float floatValueForLength(const Length& length, float maximumValue)
 
 FloatSize floatSizeForLengthSize(const LengthSize& lengthSize, const FloatSize& boxSize)
 {
-    return FloatSize(floatValueForLength(lengthSize.width(), boxSize.width()), floatValueForLength(lengthSize.height(), boxSize.height()));
+    return { floatValueForLength(lengthSize.width, boxSize.width()), floatValueForLength(lengthSize.height, boxSize.height()) };
 }
 
 } // namespace WebCore
index 9d224d9..1c4e050 100644 (file)
@@ -1,6 +1,6 @@
 /*
     Copyright (C) 1999 Lars Knoll (knoll@kde.org)
-    Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+    Copyright (C) 2006-2017 Apple Inc. All rights reserved.
     Copyright (C) 2011 Rik Cabanier (cabanier@adobe.com)
     Copyright (C) 2011 Adobe Systems Incorporated. All rights reserved.
     Copyright (C) 2012 Motorola Mobility, Inc. All rights reserved.
@@ -29,8 +29,9 @@
 namespace WebCore {
 
 class FloatSize;
-class LayoutUnit;
+class LayoutSize;
 class RenderView;
+
 struct Length;
 struct LengthSize;
 
@@ -38,6 +39,7 @@ int minimumIntValueForLength(const Length&, LayoutUnit maximumValue);
 int intValueForLength(const Length&, LayoutUnit maximumValue);
 LayoutUnit minimumValueForLength(const Length&, LayoutUnit maximumValue);
 WEBCORE_EXPORT LayoutUnit valueForLength(const Length&, LayoutUnit maximumValue);
+LayoutSize sizeForLengthSize(const LengthSize&, const LayoutSize& maximumValue);
 float floatValueForLength(const Length&, LayoutUnit maximumValue);
 WEBCORE_EXPORT float floatValueForLength(const Length&, float maximumValue);
 FloatSize floatSizeForLengthSize(const LengthSize&, const FloatSize&);
index 5383427..d769a5a 100644 (file)
@@ -23,6 +23,7 @@
 
 #include "CSSPrimitiveValueMappings.h"
 #include "CSSPropertyNames.h"
+#include "CSSValueList.h"
 #include "Document.h"
 #include "Element.h"
 #include "RenderStyle.h"
@@ -31,34 +32,34 @@ namespace WebCore {
 
 static Ref<CSSValue> paintOrder(PaintOrder paintOrder)
 {
-    Ref<CSSValueList> paintOrderList = CSSValueList::createSpaceSeparated();
-    Ref<CSSValue> fill = CSSPrimitiveValue::createIdentifier(CSSValueFill);
-    Ref<CSSValue> stroke = CSSPrimitiveValue::createIdentifier(CSSValueStroke);
-    Ref<CSSValue> markers = CSSPrimitiveValue::createIdentifier(CSSValueMarkers);
+    if (paintOrder == PaintOrderNormal)
+        return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
 
+    auto paintOrderList = CSSValueList::createSpaceSeparated();
     switch (paintOrder) {
     case PaintOrderNormal:
-        return CSSPrimitiveValue::createIdentifier(CSSValueNormal);
+        ASSERT_NOT_REACHED();
+        break;
     case PaintOrderFill:
-        paintOrderList->append(WTFMove(fill));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
         break;
     case PaintOrderFillMarkers:
-        paintOrderList->append(WTFMove(fill));
-        paintOrderList->append(WTFMove(markers));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueFill));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
         break;
     case PaintOrderStroke:
-        paintOrderList->append(WTFMove(stroke));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
         break;
     case PaintOrderStrokeMarkers:
-        paintOrderList->append(WTFMove(stroke));
-        paintOrderList->append(WTFMove(markers));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
         break;
     case PaintOrderMarkers:
-        paintOrderList->append(WTFMove(markers));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
         break;
     case PaintOrderMarkersStroke:
-        paintOrderList->append(WTFMove(markers));
-        paintOrderList->append(WTFMove(stroke));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueMarkers));
+        paintOrderList->append(CSSPrimitiveValue::createIdentifier(CSSValueStroke));
         break;
     }
     return WTFMove(paintOrderList);
index e4c7943..d4950a0 100644 (file)
@@ -294,21 +294,19 @@ inline Length StyleBuilderConverter::convertToRadiusLength(CSSToLengthConversion
 
 inline LengthSize StyleBuilderConverter::convertRadius(StyleResolver& styleResolver, const CSSValue& value)
 {
-    auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
-    Pair* pair = primitiveValue.pairValue();
+    auto* pair = downcast<CSSPrimitiveValue>(value).pairValue();
     if (!pair || !pair->first() || !pair->second())
-        return LengthSize(Length(0, Fixed), Length(0, Fixed));
+        return { { 0, Fixed }, { 0, Fixed } };
 
     CSSToLengthConversionData conversionData = styleResolver.state().cssToLengthConversionData();
-    Length radiusWidth = convertToRadiusLength(conversionData, *pair->first());
-    Length radiusHeight = convertToRadiusLength(conversionData, *pair->second());
+    LengthSize radius { convertToRadiusLength(conversionData, *pair->first()), convertToRadiusLength(conversionData, *pair->second()) };
 
-    ASSERT(!radiusWidth.isNegative());
-    ASSERT(!radiusHeight.isNegative());
-    if (radiusWidth.isZero() || radiusHeight.isZero())
-        return LengthSize(Length(0, Fixed), Length(0, Fixed));
+    ASSERT(!radius.width.isNegative());
+    ASSERT(!radius.height.isNegative());
+    if (radius.width.isZero() || radius.height.isZero())
+        return { { 0, Fixed }, { 0, Fixed } };
 
-    return LengthSize(radiusWidth, radiusHeight);
+    return radius;
 }
 
 inline Length StyleBuilderConverter::convertTo100PercentMinusLength(const Length& length)
@@ -766,7 +764,7 @@ inline RefPtr<ShapeValue> StyleBuilderConverter::convertShapeValue(StyleResolver
     }
 
     if (isImageShape(value))
-        return ShapeValue::create(styleResolver.styleImage(value));
+        return ShapeValue::create(styleResolver.styleImage(value).releaseNonNull());
 
     RefPtr<BasicShape> shape;
     CSSBoxType referenceBox = BoxMissing;
@@ -786,7 +784,7 @@ inline RefPtr<ShapeValue> StyleBuilderConverter::convertShapeValue(StyleResolver
     }
 
     if (shape)
-        return ShapeValue::create(WTFMove(shape), referenceBox);
+        return ShapeValue::create(shape.releaseNonNull(), referenceBox);
 
     if (referenceBox != BoxMissing)
         return ShapeValue::create(referenceBox);
index 0ffd9d4..fbfbd82 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Copyright (C) 2013 Google Inc. All rights reserved.
- * Copyright (C) 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2014-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -58,6 +58,11 @@ namespace WebCore {
     static void applyInitial##property(StyleResolver&); \
     static void applyValue##property(StyleResolver&, CSSValue&)
 
+template<typename T> inline T forwardInheritedValue(T&& value) { return std::forward<T>(value); }
+inline Length forwardInheritedValue(const Length& value) { auto copy = value; return copy; }
+inline LengthSize forwardInheritedValue(const LengthSize& value) { auto copy = value; return copy; }
+inline LengthBox forwardInheritedValue(const LengthBox& value) { auto copy = value; return copy; }
+
 // Note that we assume the CSS parser only allows valid CSSValue types.
 class StyleBuilderCustom {
 public:
@@ -301,6 +306,7 @@ inline void StyleBuilderCustom::applyValueVerticalAlign(StyleResolver& styleReso
 }
 
 #if ENABLE(DASHBOARD_SUPPORT)
+
 static Length convertToIntLength(const CSSPrimitiveValue* primitiveValue, const CSSToLengthConversionData& conversionData)
 {
     return primitiveValue ? primitiveValue->convertToLength<FixedIntegerConversion | PercentConversion | CalculatedConversion>(conversionData) : Length(Undefined);
@@ -318,7 +324,7 @@ inline void StyleBuilderCustom::applyValueWebkitDashboardRegion(StyleResolver& s
     if (!region)
         return;
 
-    DashboardRegion* first = region;
+    auto* first = region;
     while (region) {
         Length top = convertToIntLength(region->top(), styleResolver.state().cssToLengthConversionData().copyWithAdjustedZoom(1.0f));
         Length right = convertToIntLength(region->right(), styleResolver.state().cssToLengthConversionData().copyWithAdjustedZoom(1.0f));
@@ -335,17 +341,20 @@ inline void StyleBuilderCustom::applyValueWebkitDashboardRegion(StyleResolver& s
             left = Length();
 
         if (region->m_isCircle)
-            styleResolver.style()->setDashboardRegion(StyleDashboardRegion::Circle, region->m_label, top, right, bottom, left, region == first ? false : true);
+            styleResolver.style()->setDashboardRegion(StyleDashboardRegion::Circle, region->m_label, WTFMove(top), WTFMove(right), WTFMove(bottom), WTFMove(left), region != first);
         else if (region->m_isRectangle)
-            styleResolver.style()->setDashboardRegion(StyleDashboardRegion::Rectangle, region->m_label, top, right, bottom, left, region == first ? false : true);
+            styleResolver.style()->setDashboardRegion(StyleDashboardRegion::Rectangle, region->m_label, WTFMove(top), WTFMove(right), WTFMove(bottom), WTFMove(left), region != first);
+
         region = region->m_next.get();
     }
 
     styleResolver.document().setHasAnnotatedRegions(true);
 }
+
 #endif // ENABLE(DASHBOARD_SUPPORT)
 
 #if ENABLE(CSS_IMAGE_RESOLUTION)
+
 inline void StyleBuilderCustom::applyInheritImageResolution(StyleResolver& styleResolver)
 {
     styleResolver.style()->setImageResolutionSource(styleResolver.parentStyle()->imageResolutionSource());
@@ -378,18 +387,23 @@ inline void StyleBuilderCustom::applyValueImageResolution(StyleResolver& styleRe
     styleResolver.style()->setImageResolutionSnap(snap);
     styleResolver.style()->setImageResolution(resolution);
 }
+
 #endif // ENABLE(CSS_IMAGE_RESOLUTION)
 
 inline void StyleBuilderCustom::applyInheritSize(StyleResolver&) { }
+
 inline void StyleBuilderCustom::applyInitialSize(StyleResolver&) { }
+
 inline void StyleBuilderCustom::applyValueSize(StyleResolver& styleResolver, CSSValue& value)
 {
     styleResolver.style()->resetPageSizeType();
+
+    if (!is<CSSValueList>(value))
+        return;
+
     Length width;
     Length height;
     PageSizeType pageSizeType = PAGE_SIZE_AUTO;
-    if (!is<CSSValueList>(value))
-        return;
 
     auto& valueList = downcast<CSSValueList>(value);
     switch (valueList.length()) {
@@ -453,12 +467,12 @@ inline void StyleBuilderCustom::applyValueSize(StyleResolver& styleResolver, CSS
         return;
     }
     styleResolver.style()->setPageSizeType(pageSizeType);
-    styleResolver.style()->setPageSize(LengthSize(width, height));
+    styleResolver.style()->setPageSize({ WTFMove(width), WTFMove(height) });
 }
 
 inline void StyleBuilderCustom::applyInheritTextIndent(StyleResolver& styleResolver)
 {
-    styleResolver.style()->setTextIndent(styleResolver.parentStyle()->textIndent());
+    styleResolver.style()->setTextIndent(Length { styleResolver.parentStyle()->textIndent() });
 #if ENABLE(CSS3_TEXT)
     styleResolver.style()->setTextIndentLine(styleResolver.parentStyle()->textIndentLine());
     styleResolver.style()->setTextIndentType(styleResolver.parentStyle()->textIndentType());
@@ -496,7 +510,7 @@ inline void StyleBuilderCustom::applyValueTextIndent(StyleResolver& styleResolve
     if (lengthOrPercentageValue.isUndefined())
         return;
 
-    styleResolver.style()->setTextIndent(lengthOrPercentageValue);
+    styleResolver.style()->setTextIndent(WTFMove(lengthOrPercentageValue));
 #if ENABLE(CSS3_TEXT)
     styleResolver.style()->setTextIndentLine(textIndentLineValue);
     styleResolver.style()->setTextIndentType(textIndentTypeValue);
@@ -611,8 +625,8 @@ DEFINE_BORDER_IMAGE_MODIFIER_HANDLER(WebkitMaskBoxImage, Width)
 
 inline void StyleBuilderCustom::applyInheritLineHeight(StyleResolver& styleResolver)
 {
-    styleResolver.style()->setLineHeight(styleResolver.parentStyle()->lineHeight());
-    styleResolver.style()->setSpecifiedLineHeight(styleResolver.parentStyle()->specifiedLineHeight());
+    styleResolver.style()->setLineHeight(Length { styleResolver.parentStyle()->lineHeight() });
+    styleResolver.style()->setSpecifiedLineHeight(Length { styleResolver.parentStyle()->specifiedLineHeight() });
 }
 
 inline void StyleBuilderCustom::applyInitialLineHeight(StyleResolver& styleResolver)
@@ -628,8 +642,8 @@ inline void StyleBuilderCustom::applyValueLineHeight(StyleResolver& styleResolve
     if (!lineHeight)
         return;
 
-    styleResolver.style()->setLineHeight(lineHeight.value());
-    styleResolver.style()->setSpecifiedLineHeight(lineHeight.value());
+    styleResolver.style()->setLineHeight(Length { lineHeight.value() });
+    styleResolver.style()->setSpecifiedLineHeight(WTFMove(lineHeight.value()));
 }
 
 #endif
@@ -665,21 +679,21 @@ inline void StyleBuilderCustom::applyInheritClip(StyleResolver& styleResolver)
     auto* parentStyle = styleResolver.parentStyle();
     if (!parentStyle->hasClip())
         return applyInitialClip(styleResolver);
-    styleResolver.style()->setClip(parentStyle->clipTop(), parentStyle->clipRight(), parentStyle->clipBottom(), parentStyle->clipLeft());
+    styleResolver.style()->setClip(Length { parentStyle->clipTop() }, Length { parentStyle->clipRight() },
+        Length { parentStyle->clipBottom() }, Length { parentStyle->clipLeft() });
     styleResolver.style()->setHasClip(true);
 }
 
 inline void StyleBuilderCustom::applyValueClip(StyleResolver& styleResolver, CSSValue& value)
 {
     auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
-
-    if (Rect* rect = primitiveValue.rectValue()) {
+    if (auto* rect = primitiveValue.rectValue()) {
         auto conversionData = styleResolver.state().cssToLengthConversionData();
-        Length top = rect->top()->convertToLength<FixedIntegerConversion | PercentConversion | AutoConversion>(conversionData);
-        Length right = rect->right()->convertToLength<FixedIntegerConversion | PercentConversion | AutoConversion>(conversionData);
-        Length bottom = rect->bottom()->convertToLength<FixedIntegerConversion | PercentConversion | AutoConversion>(conversionData);
-        Length left = rect->left()->convertToLength<FixedIntegerConversion | PercentConversion | AutoConversion>(conversionData);
-        styleResolver.style()->setClip(top, right, bottom, left);
+        auto top = rect->top()->convertToLength<FixedIntegerConversion | PercentConversion | AutoConversion>(conversionData);
+        auto right = rect->right()->convertToLength<FixedIntegerConversion | PercentConversion | AutoConversion>(conversionData);
+        auto bottom = rect->bottom()->convertToLength<FixedIntegerConversion | PercentConversion | AutoConversion>(conversionData);
+        auto left = rect->left()->convertToLength<FixedIntegerConversion | PercentConversion | AutoConversion>(conversionData);
+        styleResolver.style()->setClip(WTFMove(top), WTFMove(right), WTFMove(bottom), WTFMove(left));
         styleResolver.style()->setHasClip(true);
     } else {
         ASSERT(primitiveValue.valueID() == CSSValueAuto);
@@ -735,12 +749,12 @@ inline void StyleBuilderCustom::applyValueWebkitTextZoom(StyleResolver& styleRes
     styleResolver.state().setFontDirty(true);
 }
 
-template <CSSPropertyID id>
+template<CSSPropertyID property>
 inline void StyleBuilderCustom::applyTextOrBoxShadowValue(StyleResolver& styleResolver, CSSValue& value)
 {
     if (is<CSSPrimitiveValue>(value)) {
         ASSERT(downcast<CSSPrimitiveValue>(value).valueID() == CSSValueNone);
-        if (id == CSSPropertyTextShadow)
+        if (property == CSSPropertyTextShadow)
             styleResolver.style()->setTextShadow(nullptr);
         else
             styleResolver.style()->setBoxShadow(nullptr);
@@ -761,8 +775,8 @@ inline void StyleBuilderCustom::applyTextOrBoxShadowValue(StyleResolver& styleRe
             color = styleResolver.colorFromPrimitiveValue(*shadowValue.color);
         else
             color = styleResolver.style()->color();
-        auto shadowData = std::make_unique<ShadowData>(IntPoint(x, y), blur, spread, shadowStyle, id == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent);
-        if (id == CSSPropertyTextShadow)
+        auto shadowData = std::make_unique<ShadowData>(IntPoint(x, y), blur, spread, shadowStyle, property == CSSPropertyWebkitBoxShadow, color.isValid() ? color : Color::transparent);
+        if (property == CSSPropertyTextShadow)
             styleResolver.style()->setTextShadow(WTFMove(shadowData), !isFirstEntry); // add to the list if this is not the first entry
         else
             styleResolver.style()->setBoxShadow(WTFMove(shadowData), !isFirstEntry); // add to the list if this is not the first entry
@@ -1156,22 +1170,22 @@ inline void StyleBuilderCustom::applyValueCursor(StyleResolver& styleResolver, C
 
 inline void StyleBuilderCustom::applyInitialFill(StyleResolver& styleResolver)
 {
-    SVGRenderStyle& svgStyle = styleResolver.style()->accessSVGStyle();
+    auto& svgStyle = styleResolver.style()->accessSVGStyle();
     svgStyle.setFillPaint(SVGRenderStyle::initialFillPaintType(), SVGRenderStyle::initialFillPaintColor(), SVGRenderStyle::initialFillPaintUri(), styleResolver.applyPropertyToRegularStyle(), styleResolver.applyPropertyToVisitedLinkStyle());
 }
 
 inline void StyleBuilderCustom::applyInheritFill(StyleResolver& styleResolver)
 {
-    SVGRenderStyle& svgStyle = styleResolver.style()->accessSVGStyle();
-    const SVGRenderStyle& svgParentStyle = styleResolver.parentStyle()->svgStyle();
+    auto& svgStyle = styleResolver.style()->accessSVGStyle();
+    auto& svgParentStyle = styleResolver.parentStyle()->svgStyle();
     svgStyle.setFillPaint(svgParentStyle.fillPaintType(), svgParentStyle.fillPaintColor(), svgParentStyle.fillPaintUri(), styleResolver.applyPropertyToRegularStyle(), styleResolver.applyPropertyToVisitedLinkStyle());
 
 }
 
 inline void StyleBuilderCustom::applyValueFill(StyleResolver& styleResolver, CSSValue& value)
 {
-    SVGRenderStyle& svgStyle = styleResolver.style()->accessSVGStyle();
-    const CSSPrimitiveValue* localValue = value.isPrimitiveValue() ? &downcast<CSSPrimitiveValue>(value) : nullptr;
+    auto& svgStyle = styleResolver.style()->accessSVGStyle();
+    const auto* localValue = value.isPrimitiveValue() ? &downcast<CSSPrimitiveValue>(value) : nullptr;
     String url;
     if (value.isValueList()) {
         const CSSValueList& list = downcast<CSSValueList>(value);
@@ -1183,10 +1197,10 @@ inline void StyleBuilderCustom::applyValueFill(StyleResolver& styleResolver, CSS
         return;
     
     Color color;
-    SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR;
+    auto paintType = SVG_PAINTTYPE_RGBCOLOR;
     if (localValue->isURI()) {
         paintType = SVG_PAINTTYPE_URI;
-        url = downcast<CSSPrimitiveValue>(localValue)->stringValue();
+        url = localValue->stringValue();
     } else if (localValue->isValueID() && localValue->valueID() == CSSValueNone)
         paintType = url.isEmpty() ? SVG_PAINTTYPE_NONE : SVG_PAINTTYPE_URI_NONE;
     else if (localValue->isValueID() && localValue->valueID() == CSSValueCurrentcolor) {
@@ -1207,15 +1221,15 @@ inline void StyleBuilderCustom::applyInitialStroke(StyleResolver& styleResolver)
 
 inline void StyleBuilderCustom::applyInheritStroke(StyleResolver& styleResolver)
 {
-    SVGRenderStyle& svgStyle = styleResolver.style()->accessSVGStyle();
-    const SVGRenderStyle& svgParentStyle = styleResolver.parentStyle()->svgStyle();
+    auto& svgStyle = styleResolver.style()->accessSVGStyle();
+    auto& svgParentStyle = styleResolver.parentStyle()->svgStyle();
     svgStyle.setStrokePaint(svgParentStyle.strokePaintType(), svgParentStyle.strokePaintColor(), svgParentStyle.strokePaintUri(), styleResolver.applyPropertyToRegularStyle(), styleResolver.applyPropertyToVisitedLinkStyle());
 }
 
 inline void StyleBuilderCustom::applyValueStroke(StyleResolver& styleResolver, CSSValue& value)
 {
-    SVGRenderStyle& svgStyle = styleResolver.style()->accessSVGStyle();
-    const CSSPrimitiveValue* localValue = value.isPrimitiveValue() ? &downcast<CSSPrimitiveValue>(value) : nullptr;
+    auto& svgStyle = styleResolver.style()->accessSVGStyle();
+    const auto* localValue = value.isPrimitiveValue() ? &downcast<CSSPrimitiveValue>(value) : nullptr;
     String url;
     if (value.isValueList()) {
         const CSSValueList& list = downcast<CSSValueList>(value);
@@ -1227,7 +1241,7 @@ inline void StyleBuilderCustom::applyValueStroke(StyleResolver& styleResolver, C
         return;
     
     Color color;
-    SVGPaintType paintType = SVG_PAINTTYPE_RGBCOLOR;
+    auto paintType = SVG_PAINTTYPE_RGBCOLOR;
     if (localValue->isURI()) {
         paintType = SVG_PAINTTYPE_URI;
         url = downcast<CSSPrimitiveValue>(localValue)->stringValue();
@@ -1258,7 +1272,7 @@ inline void StyleBuilderCustom::applyInheritWebkitSvgShadow(StyleResolver& style
 
 inline void StyleBuilderCustom::applyValueWebkitSvgShadow(StyleResolver& styleResolver, CSSValue& value)
 {
-    SVGRenderStyle& svgStyle = styleResolver.style()->accessSVGStyle();
+    auto& svgStyle = styleResolver.style()->accessSVGStyle();
     if (is<CSSPrimitiveValue>(value)) {
         ASSERT(downcast<CSSPrimitiveValue>(value).valueID() == CSSValueNone);
         svgStyle.setShadow(nullptr);
index 00469ee..3497b2a 100644 (file)
@@ -168,7 +168,7 @@ inline void StyleResolver::State::cacheBorderAndBackground()
     m_hasUAAppearance = m_style->hasAppearance();
     if (m_hasUAAppearance) {
         m_borderData = m_style->border();
-        m_backgroundData = *m_style->backgroundLayers();
+        m_backgroundData = m_style->backgroundLayers();
         m_backgroundColor = m_style->backgroundColor();
     }
 }
@@ -1328,7 +1328,7 @@ void StyleResolver::applyMatchedProperties(const MatchResult& matchResult, const
         // We can build up the style by copying non-inherited properties from an earlier style object built using the same exact
         // style declarations. We then only need to apply the inherited properties, if any, as their values can depend on the 
         // element context. This is fast and saves memory by reusing the style data structures.
-        state.style()->copyNonInheritedFrom(cacheItem->renderStyle.get());
+        state.style()->copyNonInheritedFrom(*cacheItem->renderStyle);
         if (state.parentStyle()->inheritedDataShared(cacheItem->parentRenderStyle.get()) && !isAtShadowBoundary(element)) {
             EInsideLink linkStatus = state.style()->insideLink();
             // If the cache item parent style has identical inherited properties to the current parent style then the
@@ -1661,17 +1661,10 @@ void StyleResolver::applyProperty(CSSPropertyID id, CSSValue* value, SelectorChe
     if (isInherit && !CSSProperty::isInheritedProperty(id))
         state.style()->setHasExplicitlyInheritedProperties();
     
-    if (id == CSSPropertyCustom) {
-        CSSCustomPropertyValue* customProperty = &downcast<CSSCustomPropertyValue>(*valueToApply);
-        if (isInherit) {
-            RefPtr<CSSCustomPropertyValue> customVal = state.parentStyle()->getCustomPropertyValue(customProperty->name());
-            if (!customVal)
-                customVal = CSSCustomPropertyValue::createInvalid();
-            state.style()->setCustomPropertyValue(customProperty->name(), customVal);
-        } else if (isInitial)
-            state.style()->setCustomPropertyValue(customProperty->name(), CSSCustomPropertyValue::createInvalid());
-        else
-            state.style()->setCustomPropertyValue(customProperty->name(), customProperty);
+    if (customPropertyValue) {
+        auto& name = customPropertyValue->name();
+        auto* value = isInitial ? nullptr : isInherit ? state.parentStyle()->customProperties().get(name) : customPropertyValue;
+        state.style()->setCustomPropertyValue(name, value ? makeRef(*value) : CSSCustomPropertyValue::createInvalid());
         return;
     }
 
index 8519855..e617c38 100755 (executable)
@@ -614,8 +614,8 @@ sub generateAnimationPropertyInheritValueSetter {
   my $indent = shift;
 
   my $setterContent = "";
-  $setterContent .= $indent . "AnimationList& list = styleResolver.style()->" . getEnsureAnimationsOrTransitionsMethod($name) . "();\n";
-  $setterContent .= $indent . "const AnimationList* parentList = styleResolver.parentStyle()->" . getAnimationsOrTransitionsMethod($name) . "();\n";
+  $setterContent .= $indent . "auto& list = styleResolver.style()->" . getEnsureAnimationsOrTransitionsMethod($name) . "();\n";
+  $setterContent .= $indent . "auto* parentList = styleResolver.parentStyle()->" . getAnimationsOrTransitionsMethod($name) . "();\n";
   $setterContent .= $indent . "size_t i = 0, parentSize = parentList ? parentList->size() : 0;\n";
   $setterContent .= $indent . "for ( ; i < parentSize && parentList->animation(i)." . getTestFunction($name) . "(); ++i) {\n";
   $setterContent .= $indent . "    if (list.size() <= i)\n";
@@ -626,7 +626,7 @@ sub generateAnimationPropertyInheritValueSetter {
   $setterContent .= $indent . "    list.animation(i).setAnimationMode(parentList->animation(i).animationMode());\n";
   $setterContent .= $indent . "}\n";
   $setterContent .= "\n";
-  $setterContent .= $indent . "/* Reset any remaining animations to not have the property set. */\n";
+  $setterContent .= $indent . "// Reset any remaining animations to not have the property set.\n";
   $setterContent .= $indent . "for ( ; i < list.size(); ++i)\n";
   $setterContent .= $indent . "    list.animation(i)." . getClearFunction($name) . "();\n";
 
@@ -674,11 +674,11 @@ sub generateFillLayerPropertyInitialValueSetter {
 
   my $setterContent = "";
   $setterContent .= $indent . "// Check for (single-layer) no-op before clearing anything.\n";
-  $setterContent .= $indent . "const FillLayer& layers = *styleResolver.style()->" . getLayersFunction($name) . "();\n";
+  $setterContent .= $indent . "auto& layers = styleResolver.style()->" . getLayersFunction($name) . "();\n";
   $setterContent .= $indent . "if (!layers.next() && (!layers." . $testFunction . "() || layers." . $getter . "() == $initial))\n";
   $setterContent .= $indent . "    return;\n";
   $setterContent .= "\n";
-  $setterContent .= $indent . "FillLayer* child = &styleResolver.style()->" . getLayersAccessorFunction($name) . "();\n";
+  $setterContent .= $indent . "auto* child = &styleResolver.style()->" . getLayersAccessorFunction($name) . "();\n";
   $setterContent .= $indent . "child->" . $setter . "(" . $initial . ");\n";
   $setterContent .= $indent . "for (child = child->next(); child; child = child->next())\n";
   $setterContent .= $indent . "    child->" . $clearFunction . "();\n";
@@ -697,12 +697,12 @@ sub generateFillLayerPropertyInheritValueSetter {
 
   my $setterContent = "";
   $setterContent .= $indent . "// Check for no-op before copying anything.\n";
-  $setterContent .= $indent . "if (*styleResolver.parentStyle()->" . getLayersFunction($name) ."() == *styleResolver.style()->" . getLayersFunction($name) . "())\n";
+  $setterContent .= $indent . "if (styleResolver.parentStyle()->" . getLayersFunction($name) ."() == styleResolver.style()->" . getLayersFunction($name) . "())\n";
   $setterContent .= $indent . "    return;\n";
   $setterContent .= "\n";
   $setterContent .= $indent . "auto* child = &styleResolver.style()->" . getLayersAccessorFunction($name) . "();\n";
   $setterContent .= $indent . "FillLayer* previousChild = nullptr;\n";
-  $setterContent .= $indent . "for (auto* parent = styleResolver.parentStyle()->" . getLayersFunction($name) . "(); parent && parent->" . $testFunction . "(); parent = parent->next()) {\n";
+  $setterContent .= $indent . "for (auto* parent = &styleResolver.parentStyle()->" . getLayersFunction($name) . "(); parent && parent->" . $testFunction . "(); parent = parent->next()) {\n";
   $setterContent .= $indent . "    if (!child) {\n";
   $setterContent .= $indent . "        previousChild->setNext(std::make_unique<FillLayer>(" . getFillLayerType($name) . "));\n";
   $setterContent .= $indent . "        child = previousChild->next();\n";
@@ -724,7 +724,7 @@ sub generateFillLayerPropertyValueSetter {
   my $CSSPropertyId = "CSSProperty" . $nameToId{$name};
 
   my $setterContent = "";
-  $setterContent .= $indent . "FillLayer* child = &styleResolver.style()->" . getLayersAccessorFunction($name) . "();\n";
+  $setterContent .= $indent . "auto* child = &styleResolver.style()->" . getLayersAccessorFunction($name) . "();\n";
   $setterContent .= $indent . "FillLayer* previousChild = nullptr;\n";
   $setterContent .= $indent . "if (is<CSSValueList>(value) && !is<CSSImageSetValue>(value)) {\n";
   $setterContent .= $indent . "    // Walk each value and put it into a layer, creating new layers as needed.\n";
@@ -830,7 +830,7 @@ sub generateInheritValueSetter {
   }
   if (!$didCallSetValue) {
     my $inheritedValue = $parentStyle . "->" . ($isSVG ? "svgStyle()." : "") .  $getter . "()";
-    $setterContent .= $indent . "    " . generateSetValueStatement($name, $inheritedValue) . ";\n";
+    $setterContent .= $indent . "    " . generateSetValueStatement($name, "forwardInheritedValue(" . $inheritedValue . ")") . ";\n";
   }
   $setterContent .= $indent . "}\n";
 
@@ -849,7 +849,7 @@ sub generateValueSetter {
     $convertedValue = "StyleBuilderConverter::convert" . $propertiesWithStyleBuilderOptions{$name}{"converter"} . "(styleResolver, value)";
   } elsif (exists($propertiesWithStyleBuilderOptions{$name}{"conditional-converter"})) {
     $setterContent .= $indent . "    auto convertedValue = StyleBuilderConverter::convert" . $propertiesWithStyleBuilderOptions{$name}{"conditional-converter"} . "(styleResolver, value);\n";
-    $convertedValue = "convertedValue.value()";
+    $convertedValue = "WTFMove(convertedValue.value())";
   } else {
     $convertedValue = "downcast<CSSPrimitiveValue>(value)";
   }
index a506265..29de371 100644 (file)
@@ -2072,7 +2072,7 @@ bool Document::isPageBoxVisible(int pageIndex)
 void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int& marginTop, int& marginRight, int& marginBottom, int& marginLeft)
 {
     updateStyleIfNeeded();
-    std::unique_ptr<RenderStyle> style = styleScope().resolver().styleForPage(pageIndex);
+    auto style = styleScope().resolver().styleForPage(pageIndex);
 
     int width = pageSize.width();
     int height = pageSize.height();
@@ -2088,11 +2088,11 @@ void Document::pageSizeAndMarginsInPixels(int pageIndex, IntSize& pageSize, int&
             std::swap(width, height);
         break;
     case PAGE_SIZE_RESOLVED: {
-        LengthSize size = style->pageSize();
-        ASSERT(size.width().isFixed());
-        ASSERT(size.height().isFixed());
-        width = valueForLength(size.width(), 0);
-        height = valueForLength(size.height(), 0);
+        auto& size = style->pageSize();
+        ASSERT(size.width.isFixed());
+        ASSERT(size.height.isFixed());
+        width = valueForLength(size.width, 0);
+        height = valueForLength(size.height, 0);
         break;
     }
     default:
index c2bdd05..7771281 100644 (file)
@@ -258,23 +258,21 @@ bool EventPath::hasEventListeners(const AtomicString& eventType) const
 Vector<EventTarget*> EventPath::computePathUnclosedToTarget(const EventTarget& target) const
 {
     Vector<EventTarget*> path;
-    const Node* targetNode = const_cast<EventTarget&>(target).toNode();
+    auto* targetNode = const_cast<EventTarget&>(target).toNode();
     if (!targetNode) {
-        const DOMWindow* domWindow = const_cast<EventTarget&>(target).toDOMWindow();
+        auto* domWindow = const_cast<EventTarget&>(target).toDOMWindow();
         if (!domWindow)
             return path;
         targetNode = domWindow->document();
         ASSERT(targetNode);
     }
-
     for (auto& context : m_path) {
-        if (Node* nodeInPath = context->currentTarget()->toNode()) {
+        if (auto* nodeInPath = context->currentTarget()->toNode()) {
             if (!targetNode->isClosedShadowHidden(*nodeInPath))
                 path.append(context->currentTarget());
         } else
             path.append(context->currentTarget());
     }
-
     return path;
 }
 
index a2e9611..dee646c 100644 (file)
@@ -47,7 +47,7 @@ public:
     virtual bool isRootedAtDocument() const = 0;
 
     ALWAYS_INLINE NodeListInvalidationType invalidationType() const { return static_cast<NodeListInvalidationType>(m_invalidationType); }
-    ContainerNode& ownerNode() const { return const_cast<ContainerNode&>(m_ownerNode.get()); }
+    ContainerNode& ownerNode() const { return m_ownerNode; }
     ALWAYS_INLINE void invalidateCacheForAttribute(const QualifiedName* attrName) const
     {
         if (!attrName || shouldInvalidateTypeOnAttributeChange(invalidationType(), *attrName))
index cc1a6a4..5ba37cf 100644 (file)
@@ -158,8 +158,8 @@ EventTarget* MessageEvent::source() const
         return nullptr;
 
     return WTF::switchOn(m_source.value(),
-        [](const RefPtr<DOMWindow>& window) -> EventTarget* { return const_cast<EventTarget*>(static_cast<const EventTarget*>(window.get())); },
-        [](const RefPtr<MessagePort>& messagePort) -> EventTarget* { return const_cast<EventTarget*>(static_cast<const EventTarget*>(messagePort.get())); }
+        [] (const RefPtr<DOMWindow>& window) -> EventTarget* { return const_cast<DOMWindow*>(window.get()); },
+        [] (const RefPtr<MessagePort>& messagePort) -> EventTarget* { return const_cast<MessagePort*>(messagePort.get()); }
     );
 }
 
index 0c2793d..038e789 100644 (file)
@@ -430,11 +430,10 @@ static HashSet<RefPtr<Node>> nodeSetPreTransformedFromNodeOrStringVector(const V
     HashSet<RefPtr<Node>> nodeSet;
     for (const auto& variant : vector) {
         WTF::switchOn(variant,
-            [&](const RefPtr<Node>& node) { nodeSet.add(const_cast<Node*>(node.get())); },
-            [](const String&) { }
+            [&] (const RefPtr<Node>& node) { nodeSet.add(const_cast<Node*>(node.get())); },
+            [] (const String&) { }
         );
     }
-
     return nodeSet;
 }
 
index 803f8fe..b9a022d 100644 (file)
@@ -54,7 +54,7 @@ public:
     WEBCORE_EXPORT static Ref<Range> create(Document&, const VisiblePosition&, const VisiblePosition&);
     WEBCORE_EXPORT ~Range();
 
-    Document& ownerDocument() const { return const_cast<Document&>(m_ownerDocument.get()); }
+    Document& ownerDocument() const { return m_ownerDocument; }
 
     Node& startContainer() const { ASSERT(m_start.container()); return *m_start.container(); }
     unsigned startOffset() const { return m_start.offset(); }
index 10b2ad9..2a58a3f 100644 (file)
@@ -48,7 +48,7 @@ public:
         return adoptRef(*new RegisteredEventListener(WTFMove(listener), options));
     }
 
-    EventListener& callback() const { return const_cast<EventListener&>(m_callback.get()); }
+    EventListener& callback() const { return m_callback; }
     bool useCapture() const { return m_useCapture; }
     bool isPassive() const { return m_isPassive; }
     bool isOnce() const { return m_isOnce; }
index 041e6d1..1d52e58 100644 (file)
@@ -52,7 +52,7 @@ ScriptRunner::~ScriptRunner()
     }
     for (auto& pendingScript : m_pendingAsyncScripts) {
         if (pendingScript->watchingForLoad())
-            const_cast<PendingScript&>(pendingScript.get()).clearClient();
+            pendingScript->clearClient();
         m_document.decrementLoadEventDelayCount();
     }
 }
index 6faad40..480126b 100644 (file)
@@ -187,7 +187,7 @@ inline CollectionType HTMLCollection::type() const
 
 inline ContainerNode& HTMLCollection::ownerNode() const
 {
-    return const_cast<ContainerNode&>(m_ownerNode.get());
+    return m_ownerNode;
 }
 
 inline Document& HTMLCollection::document() const
index ef206f6..9853198 100644 (file)
@@ -127,7 +127,7 @@ inline Ref<HTMLStackItem> HTMLStackItem::create(DocumentFragment& fragment)
 
 inline ContainerNode& HTMLStackItem::node() const
 {
-    return const_cast<ContainerNode&>(m_node.get());
+    return m_node.get();
 }
 
 inline Element& HTMLStackItem::element() const
index 3ac2870..c2e514c 100644 (file)
@@ -133,58 +133,44 @@ void PageScriptDebugServer::setJavaScriptPaused(const PageGroup& pageGroup, bool
 {
     setMainThreadCallbacksPaused(paused);
 
-    for (auto& page : pageGroup.pages())
-        setJavaScriptPaused(page, paused);
-}
-
-void PageScriptDebugServer::setJavaScriptPaused(Page* page, bool paused)
-{
-    ASSERT_ARG(page, page);
-
-    page->setDefersLoading(paused);
-
-    for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
-        setJavaScriptPaused(frame, paused);
-
-    if (InspectorFrontendClient* frontendClient = page->inspectorController().inspectorFrontendClient()) {
-        if (paused)
-            frontendClient->pagePaused();
-        else
-            frontendClient->pageUnpaused();
+    for (auto& page : pageGroup.pages()) {
+        page->setDefersLoading(paused);
+
+        for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext())
+            setJavaScriptPaused(*frame, paused);
+
+        if (auto* frontendClient = page->inspectorController().inspectorFrontendClient()) {
+            if (paused)
+                frontendClient->pagePaused();
+            else
+                frontendClient->pageUnpaused();
+        }
     }
 }
 
-void PageScriptDebugServer::setJavaScriptPaused(Frame* frame, bool paused)
+void PageScriptDebugServer::setJavaScriptPaused(Frame& frame, bool paused)
 {
-    ASSERT_ARG(frame, frame);
-
-    if (!frame->script().canExecuteScripts(NotAboutToExecuteScript))
+    if (!frame.script().canExecuteScripts(NotAboutToExecuteScript))
         return;
 
-    frame->script().setPaused(paused);
+    frame.script().setPaused(paused);
 
-    Document* document = frame->document();
+    ASSERT(frame.document());
+    auto& document = *frame.document();
     if (paused) {
-        document->suspendScriptedAnimationControllerCallbacks();
-        document->suspendActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused);
+        document.suspendScriptedAnimationControllerCallbacks();
+        document.suspendActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused);
     } else {
-        document->resumeActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused);
-        document->resumeScriptedAnimationControllerCallbacks();
+        document.resumeActiveDOMObjects(ActiveDOMObject::JavaScriptDebuggerPaused);
+        document.resumeScriptedAnimationControllerCallbacks();
     }
 
-    setJavaScriptPaused(frame->view(), paused);
-}
-
-void PageScriptDebugServer::setJavaScriptPaused(FrameView* view, bool paused)
-{
-    if (!view)
-        return;
-
-    for (auto& child : view->children()) {
-        if (!is<PluginViewBase>(*child))
-            continue;
-
-        downcast<PluginViewBase>(*child).setJavaScriptPaused(paused);
+    if (auto* view = frame.view()) {
+        for (auto& child : view->children()) {
+            if (!is<PluginViewBase>(child.get()))
+                continue;
+            downcast<PluginViewBase>(child.get()).setJavaScriptPaused(paused);
+        }
     }
 }
 
index 3b49791..7f58c6c 100644 (file)
@@ -31,7 +31,6 @@
 namespace WebCore {
 
 class Frame;
-class FrameView;
 class Page;
 class PageGroup;
 
@@ -56,9 +55,7 @@ private:
     void runEventLoopWhilePausedInternal();
 
     void setJavaScriptPaused(const PageGroup&, bool paused);
-    void setJavaScriptPaused(Page*, bool paused);
-    void setJavaScriptPaused(Frame*, bool paused);
-    void setJavaScriptPaused(FrameView*, bool paused);
+    void setJavaScriptPaused(Frame&, bool paused);
 
     Page& m_page;
 };
index 4e82754..295b94a 100644 (file)
@@ -741,7 +741,7 @@ void HistoryController::recursiveSetProvisionalItem(HistoryItem& item, HistoryIt
         Frame* childFrame = m_frame.tree().child(childFrameName);
         ASSERT(childFrame);
 
-        childFrame->loader().history().recursiveSetProvisionalItem(const_cast<HistoryItem&>(childItem.get()), fromChildItem);
+        childFrame->loader().history().recursiveSetProvisionalItem(childItem, fromChildItem);
     }
 }
 
@@ -761,7 +761,7 @@ void HistoryController::recursiveGoToItem(HistoryItem& item, HistoryItem* fromIt
         HistoryItem* fromChildItem = fromItem->childItemWithTarget(childFrameName);
         ASSERT(fromChildItem);
         if (Frame* childFrame = m_frame.tree().child(childFrameName))
-            childFrame->loader().history().recursiveGoToItem(const_cast<HistoryItem&>(childItem.get()), fromChildItem, type);
+            childFrame->loader().history().recursiveGoToItem(childItem, fromChildItem, type);
     }
 }
 
index 0bb288e..d5a5106 100644 (file)
@@ -723,31 +723,27 @@ RenderView* Frame::contentRenderer() const
 
 RenderWidget* Frame::ownerRenderer() const
 {
-    HTMLFrameOwnerElement* ownerElement = m_ownerElement;
+    auto* ownerElement = m_ownerElement;
     if (!ownerElement)
         return nullptr;
     auto* object = ownerElement->renderer();
-    if (!object)
-        return nullptr;
     // FIXME: If <object> is ever fixed to disassociate itself from frames
     // that it has started but canceled, then this can turn into an ASSERT
-    // since m_ownerElement would be 0 when the load is canceled.
+    // since m_ownerElement would be nullptr when the load is canceled.
     // https://bugs.webkit.org/show_bug.cgi?id=18585
-    if (!is<RenderWidget>(*object))
+    if (!is<RenderWidget>(object))
         return nullptr;
     return downcast<RenderWidget>(object);
 }
 
-Frame* Frame::frameForWidget(const Widget* widget)
+Frame* Frame::frameForWidget(const Widget& widget)
 {
-    ASSERT_ARG(widget, widget);
-
-    if (RenderWidget* renderer = RenderWidget::find(widget))
+    if (auto* renderer = RenderWidget::find(widget))
         return renderer->frameOwnerElement().document().frame();
 
     // Assume all widgets are either a FrameView or owned by a RenderWidget.
     // FIXME: That assumption is not right for scroll bars!
-    return &downcast<FrameView>(*widget).frame();
+    return &downcast<FrameView>(widget).frame();
 }
 
 void Frame::clearTimers(FrameView *view, Document *document)
index 6834110..9a8f73c 100644 (file)
@@ -164,7 +164,7 @@ public:
     WEBCORE_EXPORT String layerTreeAsText(LayerTreeFlags = 0) const;
     WEBCORE_EXPORT String trackedRepaintRectsAsText() const;
 
-    WEBCORE_EXPORT static Frame* frameForWidget(const Widget*);
+    WEBCORE_EXPORT static Frame* frameForWidget(const Widget&);
 
     Settings& settings() const { return *m_settings; }
 
index 77075fd..b291236 100644 (file)
@@ -3,7 +3,7 @@
  *                     1999 Lars Knoll <knoll@kde.org>
  *                     1999 Antti Koivisto <koivisto@kde.org>
  *                     2000 Dirk Mueller <mueller@kde.org>
- * Copyright (C) 2004-2008, 2013-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
  *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
  *           (C) 2006 Alexey Proskuryakov (ap@nypop.com)
  * Copyright (C) 2009 Google Inc. All rights reserved.
@@ -506,18 +506,17 @@ bool FrameView::didFirstLayout() const
 void FrameView::invalidateRect(const IntRect& rect)
 {
     if (!parent()) {
-        if (HostWindow* window = hostWindow())
-            window->invalidateContentsAndRootView(rect);
+        if (auto* page = frame().page())
+            page->chrome().invalidateContentsAndRootView(rect);
         return;
     }
 
-    RenderWidget* renderer = frame().ownerRenderer();
+    auto* renderer = frame().ownerRenderer();
     if (!renderer)
         return;
 
     IntRect repaintRect = rect;
-    repaintRect.move(renderer->borderLeft() + renderer->paddingLeft(),
-                     renderer->borderTop() + renderer->paddingTop());
+    repaintRect.move(renderer->borderLeft() + renderer->paddingLeft(), renderer->borderTop() + renderer->paddingTop());
     renderer->repaintRectangle(repaintRect);
 }
 
@@ -544,14 +543,16 @@ void FrameView::setFrameRect(const IntRect& newRect)
 }
 
 #if ENABLE(REQUEST_ANIMATION_FRAME)
+
 bool FrameView::scheduleAnimation()
 {
-    if (HostWindow* window = hostWindow()) {
-        window->scheduleAnimation();
-        return true;
-    }
-    return false;
+    auto* page = frame().page();
+    if (!page)
+        return false;
+    page->chrome().scheduleAnimation();
+    return true;
 }
+
 #endif
 
 void FrameView::setMarginWidth(LayoutUnit w)
@@ -1056,22 +1057,22 @@ GraphicsLayer* FrameView::graphicsLayerForPlatformWidget(PlatformWidget platform
 {
     // To find the Widget that corresponds with platformWidget we have to do a linear
     // search of our child widgets.
-    Widget* foundWidget = nullptr;
+    const Widget* foundWidget = nullptr;
     for (auto& widget : children()) {
         if (widget->platformWidget() != platformWidget)
             continue;
-        foundWidget = widget.get();
+        foundWidget = widget.ptr();
         break;
     }
 
     if (!foundWidget)
         return nullptr;
 
-    auto* renderWidget = RenderWidget::find(foundWidget);
+    auto* renderWidget = RenderWidget::find(*foundWidget);
     if (!renderWidget)
         return nullptr;
 
-    RenderLayer* widgetLayer = renderWidget->layer();
+    auto* widgetLayer = renderWidget->layer();
     if (!widgetLayer || !widgetLayer->isComposited())
         return nullptr;
 
@@ -2180,11 +2181,11 @@ bool FrameView::shouldSetCursor() const
 bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
 {
     if (!m_viewportConstrainedObjects || m_viewportConstrainedObjects->isEmpty()) {
-        hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
+        frame().page()->chrome().scroll(scrollDelta, rectToScroll, clipRect);
         return true;
     }
 
-    const bool isCompositedContentLayer = usesCompositedScrolling();
+    bool isCompositedContentLayer = usesCompositedScrolling();
 
     // Get the rects of the fixed objects visible in the rectToScroll
     Region regionToUpdate;
@@ -2220,7 +2221,7 @@ bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect
     }
 
     // 1) scroll
-    hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
+    frame().page()->chrome().scroll(scrollDelta, rectToScroll, clipRect);
 
     // 2) update the area of fixed objects that has been invalidated
     for (auto& updateRect : regionToUpdate.rects()) {
@@ -2235,7 +2236,7 @@ bool FrameView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect
         }
         if (clipsRepaints())
             updateRect.intersect(rectToScroll);
-        hostWindow()->invalidateContentsAndRootView(updateRect);
+        frame().page()->chrome().invalidateContentsAndRootView(updateRect);
     }
 
     return true;
@@ -2642,9 +2643,10 @@ bool FrameView::requestScrollPositionUpdate(const ScrollPosition& position)
 
 HostWindow* FrameView::hostWindow() const
 {
-    if (Page* page = frame().page())
-        return &page->chrome();
-    return nullptr;
+    auto* page = frame().page();
+    if (!page)
+        return nullptr;
+    return &page->chrome();
 }
 
 void FrameView::addTrackedRepaintRect(const FloatRect& r)
@@ -2784,10 +2786,12 @@ void FrameView::adjustTiledBackingScrollability()
 }
 
 #if PLATFORM(IOS)
+
 void FrameView::unobscuredContentSizeChanged()
 {
     adjustTiledBackingScrollability();
 }
+
 #endif
 
 static LayerFlushThrottleState::Flags determineLayerFlushThrottleState(Page& page)
@@ -4082,8 +4086,6 @@ void FrameView::updateScrollCorner()
             m_scrollCorner->setStyle(WTFMove(*cornerStyle));
         invalidateScrollCorner(cornerRect);
     }
-
-    ScrollView::updateScrollCorner();
 }
 
 void FrameView::paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect)
@@ -4157,15 +4159,14 @@ Color FrameView::documentBackgroundColor() const
 bool FrameView::hasCustomScrollbars() const
 {
     for (auto& widget : children()) {
-        if (is<FrameView>(*widget)) {
-            if (downcast<FrameView>(*widget).hasCustomScrollbars())
+        if (is<FrameView>(widget.get())) {
+            if (downcast<FrameView>(widget.get()).hasCustomScrollbars())
                 return true;
-        } else if (is<Scrollbar>(*widget)) {
-            if (downcast<Scrollbar>(*widget).isCustomScrollbar())
+        } else if (is<Scrollbar>(widget.get())) {
+            if (downcast<Scrollbar>(widget.get()).isCustomScrollbar())
                 return true;
         }
     }
-
     return false;
 }
 
@@ -4173,11 +4174,10 @@ FrameView* FrameView::parentFrameView() const
 {
     if (!parent())
         return nullptr;
-
-    if (Frame* parentFrame = frame().tree().parent())
-        return parentFrame->view();
-
-    return nullptr;
+    auto* parentFrame = frame().tree().parent();
+    if (!parentFrame)
+        return nullptr;
+    return parentFrame->view();
 }
 
 bool FrameView::isInChildFrameWithFrameFlattening() const
@@ -5183,8 +5183,8 @@ void FrameView::updateWidgetPositions()
     // scripts in response to NPP_SetWindow, for example), so we need to keep the Widgets
     // alive during enumeration.
     for (auto& widget : collectAndProtectWidgets(m_widgetsInRenderTree)) {
-        if (RenderWidget* renderWidget = RenderWidget::find(widget.get())) {
-            auto ignoreWidgetState = renderWidget->updateWidgetPosition();
+        if (auto* renderer = RenderWidget::find(*widget)) {
+            auto ignoreWidgetState = renderer->updateWidgetPosition();
             UNUSED_PARAM(ignoreWidgetState);
         }
     }
index 23a7fd1..711b74b 100644 (file)
@@ -4,7 +4,7 @@
              (C) 1998, 1999 Torben Weis (weis@kde.org)
              (C) 1999 Lars Knoll (knoll@kde.org)
              (C) 1999 Antti Koivisto (koivisto@kde.org)
-   Copyright (C) 2004-2009, 2014-2016 Apple Inc. All rights reserved.
+   Copyright (C) 2004-2017 Apple Inc. All rights reserved.
 
    This library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public
@@ -74,16 +74,16 @@ public:
 
     virtual ~FrameView();
 
-    HostWindow* hostWindow() const override;
+    HostWindow* hostWindow() const final;
     
-    WEBCORE_EXPORT void invalidateRect(const IntRect&) override;
-    void setFrameRect(const IntRect&) override;
+    WEBCORE_EXPORT void invalidateRect(const IntRect&) final;
+    void setFrameRect(const IntRect&) final;
 
 #if ENABLE(REQUEST_ANIMATION_FRAME)
-    bool scheduleAnimation() override;
+    bool scheduleAnimation() final;
 #endif
 
-    Frame& frame() const { return const_cast<Frame&>(m_frame.get()); }
+    Frame& frame() const { return m_frame; }
 
     WEBCORE_EXPORT RenderView* renderView() const;
 
@@ -95,15 +95,15 @@ public:
     void setMarginWidth(LayoutUnit);
     void setMarginHeight(LayoutUnit);
 
-    WEBCORE_EXPORT void setCanHaveScrollbars(bool) override;
+    WEBCORE_EXPORT void setCanHaveScrollbars(bool) final;
     WEBCORE_EXPORT void updateCanHaveScrollbars();
 
-    Ref<Scrollbar> createScrollbar(ScrollbarOrientation) override;
+    Ref<Scrollbar> createScrollbar(ScrollbarOrientation) final;
 
-    bool avoidScrollbarCreation() const override;
+    bool avoidScrollbarCreation() const final;
 
-    void setContentsSize(const IntSize&) override;
-    void updateContentsSize() override;
+    void setContentsSize(const IntSize&) final;
+    void updateContentsSize() final;
 
     void layout(bool allowSubtree = true);
     WEBCORE_EXPORT bool didFirstLayout() const;
@@ -162,7 +162,7 @@ public:
     WEBCORE_EXPORT GraphicsLayer* graphicsLayerForPlatformWidget(PlatformWidget);
     WEBCORE_EXPORT void scheduleLayerFlushAllowingThrottling();
 
-    WEBCORE_EXPORT TiledBacking* tiledBacking() const override;
+    WEBCORE_EXPORT TiledBacking* tiledBacking() const final;
 
     // In the future when any ScrollableArea can have a node in th ScrollingTree, this should
     // become a virtual function on ScrollableArea.
@@ -225,21 +225,21 @@ public:
     WEBCORE_EXPORT void setViewportSizeForCSSViewportUnits(IntSize);
     IntSize viewportSizeForCSSViewportUnits() const;
     
-    IntRect windowClipRect() const override;
+    IntRect windowClipRect() const final;
     WEBCORE_EXPORT IntRect windowClipRectForFrameOwner(const HTMLFrameOwnerElement*, bool clipToLayerContents) const;
 
-    float visibleContentScaleFactor() const override;
+    float visibleContentScaleFactor() const final;
 
 #if USE(COORDINATED_GRAPHICS)
-    void setFixedVisibleContentRect(const IntRect&) override;
+    void setFixedVisibleContentRect(const IntRect&) final;
 #endif
-    WEBCORE_EXPORT void setScrollPosition(const ScrollPosition&) override;
-    void updateLayerPositionsAfterScrolling() override;
-    void updateCompositingLayersAfterScrolling() override;
-    bool requestScrollPositionUpdate(const ScrollPosition&) override;
-    bool isRubberBandInProgress() const override;
-    WEBCORE_EXPORT ScrollPosition minimumScrollPosition() const override;
-    WEBCORE_EXPORT ScrollPosition maximumScrollPosition() const override;
+    WEBCORE_EXPORT void setScrollPosition(const ScrollPosition&) final;
+    void updateLayerPositionsAfterScrolling() final;
+    void updateCompositingLayersAfterScrolling() final;
+    bool requestScrollPositionUpdate(const ScrollPosition&) final;
+    bool isRubberBandInProgress() const final;
+    WEBCORE_EXPORT ScrollPosition minimumScrollPosition() const final;
+    WEBCORE_EXPORT ScrollPosition maximumScrollPosition() const final;
 
     // The scrollOrigin, scrollPosition, minimumScrollPosition and maximumScrollPosition are all affected by frame scale,
     // but layoutViewport computations require unscaled scroll positions.
@@ -347,7 +347,7 @@ public:
     void addEmbeddedObjectToUpdate(RenderEmbeddedObject&);
     void removeEmbeddedObjectToUpdate(RenderEmbeddedObject&);
 
-    WEBCORE_EXPORT void paintContents(GraphicsContext&, const IntRect& dirtyRect) override;
+    WEBCORE_EXPORT void paintContents(GraphicsContext&, const IntRect& dirtyRect) final;
 
     struct PaintingState {
         PaintBehavior paintBehavior;
@@ -379,9 +379,9 @@ public:
     enum CoordinateSpaceForSnapshot { DocumentCoordinates, ViewCoordinates };
     WEBCORE_EXPORT void paintContentsForSnapshot(GraphicsContext&, const IntRect& imageRect, SelectionInSnapshot shouldPaintSelection, CoordinateSpaceForSnapshot);
 
-    void paintOverhangAreas(GraphicsContext&, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) override;
-    void paintScrollCorner(GraphicsContext&, const IntRect& cornerRect) override;
-    void paintScrollbar(GraphicsContext&, Scrollbar&, const IntRect&) override;
+    void paintOverhangAreas(GraphicsContext&, const IntRect& horizontalOverhangArea, const IntRect& verticalOverhangArea, const IntRect& dirtyRect) final;
+    void paintScrollCorner(GraphicsContext&, const IntRect& cornerRect) final;
+    void paintScrollbar(GraphicsContext&, Scrollbar&, const IntRect&) final;
 
     WEBCORE_EXPORT Color documentBackgroundColor() const;
 
@@ -436,10 +436,10 @@ public:
     WEBCORE_EXPORT IntPoint convertFromContainingViewToRenderer(const RenderElement*, const IntPoint&) const;
 
     // Override ScrollView methods to do point conversion via renderers, in order to take transforms into account.
-    IntRect convertToContainingView(const IntRect&) const override;
-    IntRect convertFromContainingView(const IntRect&) const override;
-    IntPoint convertToContainingView(const IntPoint&) const override;
-    IntPoint convertFromContainingView(const IntPoint&) const override;
+    IntRect convertToContainingView(const IntRect&) const final;
+    IntRect convertFromContainingView(const IntRect&) const final;
+    IntPoint convertToContainingView(const IntPoint&) const final;
+    IntPoint convertFromContainingView(const IntPoint&) const final;
 
     bool isFrameViewScrollCorner(const RenderScrollbarPart& scrollCorner) const { return m_scrollCorner == &scrollCorner; }
 
@@ -451,20 +451,20 @@ public:
     enum class Scrollability { Scrollable, ScrollableOrRubberbandable };
     WEBCORE_EXPORT bool isScrollable(Scrollability definitionOfScrollable = Scrollability::Scrollable);
 
-    bool isScrollableOrRubberbandable() override;
-    bool hasScrollableOrRubberbandableAncestor() override;
+    bool isScrollableOrRubberbandable() final;
+    bool hasScrollableOrRubberbandableAncestor() final;
 
     enum ScrollbarModesCalculationStrategy { RulesFromWebContentOnly, AnyRule };
     void calculateScrollbarModesForLayout(ScrollbarMode& hMode, ScrollbarMode& vMode, ScrollbarModesCalculationStrategy = AnyRule);
 
-    IntPoint lastKnownMousePosition() const override;
-    bool isHandlingWheelEvent() const override;
+    IntPoint lastKnownMousePosition() const final;
+    bool isHandlingWheelEvent() const final;
     bool shouldSetCursor() const;
 
     // FIXME: Remove this method once plugin loading is decoupled from layout.
     void flushAnyPendingPostLayoutTasks();
 
-    bool shouldSuspendScrollAnimations() const override;
+    bool shouldSuspendScrollAnimations() const final;
     void scrollbarStyleChanged(ScrollbarStyle, bool forceUpdate) override;
 
     RenderBox* embeddedContentBox() const;
@@ -483,7 +483,7 @@ public:
     bool containsScrollableArea(ScrollableArea*) const;
     const ScrollableAreaSet* scrollableAreas() const { return m_scrollableAreas.get(); }
 
-    void removeChild(Widget&) override;
+    void removeChild(Widget&) final;
 
     // This function exists for ports that need to handle wheel events manually.
     // On Mac WebKit1 the underlying NSScrollView just does the scrolling, but on most other platforms
@@ -501,7 +501,7 @@ public:
     const Pagination& pagination() const;
     void setPagination(const Pagination&);
     
-    bool inProgrammaticScroll() const override { return m_inProgrammaticScroll; }
+    bool inProgrammaticScroll() const final { return m_inProgrammaticScroll; }
     void setInProgrammaticScroll(bool programmaticScroll) { m_inProgrammaticScroll = programmaticScroll; }
 
 #if ENABLE(CSS_DEVICE_ADAPTATION)
@@ -509,8 +509,8 @@ public:
     void setInitialViewportSize(const IntSize& size) { m_initialViewportSize = size; }
 #endif
 
-    bool isActive() const override;
-    bool forceUpdateScrollbarsOnMainThreadForPerformanceTesting() const override;
+    bool isActive() const final;
+    bool forceUpdateScrollbarsOnMainThreadForPerformanceTesting() const final;
 
 #if ENABLE(RUBBER_BANDING)
     WEBCORE_EXPORT GraphicsLayer* setWantsLayerForTopOverHangArea(bool) const;
@@ -523,20 +523,20 @@ public:
 
     LayoutPoint scrollPositionRespectingCustomFixedPosition() const;
 
-    int headerHeight() const override { return m_headerHeight; }
+    int headerHeight() const final { return m_headerHeight; }
     WEBCORE_EXPORT void setHeaderHeight(int);
-    int footerHeight() const override { return m_footerHeight; }
+    int footerHeight() const final { return m_footerHeight; }
     WEBCORE_EXPORT void setFooterHeight(int);
 
-    WEBCORE_EXPORT float topContentInset(TopContentInsetType = TopContentInsetType::WebCoreContentInset) const override;
+    WEBCORE_EXPORT float topContentInset(TopContentInsetType = TopContentInsetType::WebCoreContentInset) const final;
     void topContentInsetDidChange(float newTopContentInset);
 
     void topContentDirectionDidChange();
 
-    WEBCORE_EXPORT void willStartLiveResize() override;
-    WEBCORE_EXPORT void willEndLiveResize() override;
+    WEBCORE_EXPORT void willStartLiveResize() final;
+    WEBCORE_EXPORT void willEndLiveResize() final;
 
-    WEBCORE_EXPORT void availableContentSizeChanged(AvailableSizeChangeReason) override;
+    WEBCORE_EXPORT void availableContentSizeChanged(AvailableSizeChangeReason) final;
 
     void adjustTiledBackingScrollability();
 
@@ -574,29 +574,29 @@ public:
     std::optional<FloatRect> viewExposedRect() const { return m_viewExposedRect; }
 
 #if ENABLE(CSS_SCROLL_SNAP)
-    void updateSnapOffsets() override;
-    bool isScrollSnapInProgress() const override;
+    void updateSnapOffsets() final;
+    bool isScrollSnapInProgress() const final;
     void updateScrollingCoordinatorScrollSnapProperties() const;
 #endif
 
-    float adjustScrollStepForFixedContent(float step, ScrollbarOrientation, ScrollGranularity) override;
+    float adjustScrollStepForFixedContent(float step, ScrollbarOrientation, ScrollGranularity) final;
 
     void didChangeScrollOffset();
 
-    void show() override;
+    void show() final;
 
     bool shouldPlaceBlockDirectionScrollbarOnLeft() const final;
 
     void didRestoreFromPageCache();
 
 protected:
-    bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) override;
-    void scrollContentsSlowPath(const IntRect& updateRect) override;
+    bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) final;
+    void scrollContentsSlowPath(const IntRect& updateRect) final;
     
     void repaintSlowRepaintObjects();
 
-    bool isVerticalDocument() const override;
-    bool isFlippedDocument() const override;
+    bool isVerticalDocument() const final;
+    bool isFlippedDocument() const final;
 
 private:
     explicit FrameView(Frame&);
@@ -617,7 +617,7 @@ private:
 
     bool inPreLayoutStyleUpdate() const { return m_layoutPhase == InPreLayoutStyleUpdate; }
 
-    bool isFrameView() const override { return true; }
+    bool isFrameView() const final { return true; }
 
     friend class RenderWidget;
     bool useSlowRepaints(bool considerOverlap = true) const;
@@ -628,9 +628,9 @@ private:
     bool shouldUpdateCompositingLayersAfterScrolling() const;
     bool flushCompositingStateForThisFrame(const Frame& rootFrameForFlush);
 
-    bool shouldDeferScrollUpdateAfterContentSizeChange() override;
+    bool shouldDeferScrollUpdateAfterContentSizeChange() final;
 
-    void scrollOffsetChangedViaPlatformWidgetImpl(const ScrollOffset& oldOffset, const ScrollOffset& newOffset) override;
+    void scrollOffsetChangedViaPlatformWidgetImpl(const ScrollOffset& oldOffset, const ScrollOffset& newOffset) final;
 
     void applyOverflowToViewport(const RenderElement&, ScrollbarMode& hMode, ScrollbarMode& vMode);
     void applyPaginationToViewport();
@@ -651,39 +651,39 @@ private:
     void updateLayerFlushThrottling();
     WEBCORE_EXPORT void adjustTiledBackingCoverage();
 
-    void repaintContentRectangle(const IntRect&) override;
-    void addedOrRemovedScrollbar() override;
+    void repaintContentRectangle(const IntRect&) final;
+    void addedOrRemovedScrollbar() final;
 
-    void delegatesScrollingDidChange() override;
+    void delegatesScrollingDidChange() final;
 
     // ScrollableArea interface
-    void invalidateScrollbarRect(Scrollbar&, const IntRect&) override;
-    void scrollTo(const ScrollPosition&) override;
-    void setVisibleScrollerThumbRect(const IntRect&) override;
-    ScrollableArea* enclosingScrollableArea() const override;
-    IntRect scrollableAreaBoundingBox(bool* = nullptr) const override;
-    bool scrollAnimatorEnabled() const override;
-    GraphicsLayer* layerForScrolling() const override;
-    GraphicsLayer* layerForHorizontalScrollbar() const override;
-    GraphicsLayer* layerForVerticalScrollbar() const override;
-    GraphicsLayer* layerForScrollCorner() const override;
+    void invalidateScrollbarRect(Scrollbar&, const IntRect&) final;
+    void scrollTo(const ScrollPosition&) final;
+    void setVisibleScrollerThumbRect(const IntRect&) final;
+    ScrollableArea* enclosingScrollableArea() const final;
+    IntRect scrollableAreaBoundingBox(bool* = nullptr) const final;
+    bool scrollAnimatorEnabled() const final;
+    GraphicsLayer* layerForScrolling() const final;
+    GraphicsLayer* layerForHorizontalScrollbar() const final;
+    GraphicsLayer* layerForVerticalScrollbar() const final;
+    GraphicsLayer* layerForScrollCorner() const final;
 #if ENABLE(RUBBER_BANDING)
-    GraphicsLayer* layerForOverhangAreas() const override;
+    GraphicsLayer* layerForOverhangAreas() const final;
 #endif
-    void contentsResized() override;
+    void contentsResized() final;
 
 #if PLATFORM(IOS)
-    void unobscuredContentSizeChanged() override;
+    void unobscuredContentSizeChanged() final;
 #endif
 
-    bool usesCompositedScrolling() const override;
-    bool usesAsyncScrolling() const override;
-    bool usesMockScrollAnimator() const override;
-    void logMockScrollAnimatorMessage(const String&) const override;
+    bool usesCompositedScrolling() const final;
+    bool usesAsyncScrolling() const final;
+    bool usesMockScrollAnimator() const final;
+    void logMockScrollAnimatorMessage(const String&) const final;
 
     // Override scrollbar notifications to update the AXObject cache.
-    void didAddScrollbar(Scrollbar*, ScrollbarOrientation) override;
-    void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation) override;
+    void didAddScrollbar(Scrollbar*, ScrollbarOrientation) final;
+    void willRemoveScrollbar(Scrollbar*, ScrollbarOrientation) final;
 
     IntSize sizeForResizeEvent() const;
     void sendResizeEventIfNeeded();
@@ -693,7 +693,7 @@ private:
     void updateScrollableAreaSet();
     void updateLayoutViewport();
 
-    void notifyPageThatContentAreaWillPaint() const override;
+    void notifyPageThatContentAreaWillPaint() const final;
 
     void enableSpeculativeTilingIfNeeded();
     void speculativeTilingEnableTimerFired();
@@ -708,7 +708,7 @@ private:
 
     bool hasCustomScrollbars() const;
 
-    void updateScrollCorner() override;
+    void updateScrollCorner() final;
 
     FrameView* parentFrameView() const;
 
index daf88fb..4d272c9 100644 (file)
@@ -1392,18 +1392,15 @@ void Page::dnsPrefetchingStateChanged()
 Vector<Ref<PluginViewBase>> Page::pluginViews()
 {
     Vector<Ref<PluginViewBase>> views;
-
     for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) {
-        FrameView* view = frame->view();
+        auto* view = frame->view();
         if (!view)
             break;
-
         for (auto& widget : view->children()) {
-            if (is<PluginViewBase>(*widget))
-                views.append(downcast<PluginViewBase>(*widget));
+            if (is<PluginViewBase>(widget.get()))
+                views.append(downcast<PluginViewBase>(widget.get()));
         }
     }
-
     return views;
 }
 
index 4430546..67ce317 100644 (file)
@@ -286,16 +286,19 @@ void PrintContext::outputLinkedDestinations(GraphicsContext& graphicsContext, Do
 
 String PrintContext::pageProperty(Frame* frame, const char* propertyName, int pageNumber)
 {
-    Document* document = frame->document();
+    ASSERT(frame);
+    ASSERT(frame->document());
+
+    auto& document = *frame->document();
     PrintContext printContext(frame);
     printContext.begin(800); // Any width is OK here.
-    document->updateLayout();
-    std::unique_ptr<RenderStyle> style = document->styleScope().resolver().styleForPage(pageNumber);
+    document.updateLayout();
+    auto style = document.styleScope().resolver().styleForPage(pageNumber);
 
     // Implement formatters for properties we care about.
     if (!strcmp(propertyName, "margin-left")) {
         if (style->marginLeft().isAuto())
-            return String("auto");
+            return ASCIILiteral { "auto" };
         return String::number(style->marginLeft().value());
     }
     if (!strcmp(propertyName, "line-height"))
@@ -305,9 +308,9 @@ String PrintContext::pageProperty(Frame* frame, const char* propertyName, int pa
     if (!strcmp(propertyName, "font-family"))
         return style->fontDescription().firstFamily();
     if (!strcmp(propertyName, "size"))
-        return String::number(style->pageSize().width().value()) + ' ' + String::number(style->pageSize().height().value());
+        return String::number(style->pageSize().width.value()) + ' ' + String::number(style->pageSize().height.value());
 
-    return String("pageProperty() unimplemented for: ") + propertyName;
+    return makeString("pageProperty() unimplemented for: ", propertyName);
 }
 
 bool PrintContext::isPageBoxVisible(Frame* frame, int pageNumber)
index 1c47e3d..76e80c0 100644 (file)
@@ -494,7 +494,7 @@ void AnimationBase::fireAnimationEventsIfNeeded()
         if (m_animation->trigger() && m_animation->trigger()->isScrollAnimationTrigger()) {
             if (m_object) {
                 float offset = m_compositeAnimation->animationController().scrollPosition();
-                ScrollAnimationTrigger& scrollTrigger = downcast<ScrollAnimationTrigger>(*m_animation->trigger().get());
+                auto& scrollTrigger = downcast<ScrollAnimationTrigger>(*m_animation->trigger());
                 if (offset > scrollTrigger.startValue().value())
                     updateStateMachine(AnimationStateInput::StartTimerFired, 0);
             }
@@ -577,7 +577,7 @@ double AnimationBase::timeToNextService()
         if (m_animation->trigger()->isScrollAnimationTrigger()) {
             if (m_object) {
                 float currentScrollPosition = m_object->view().frameView().scrollPositionForFixedPosition().y().toFloat();
-                ScrollAnimationTrigger& scrollTrigger = downcast<ScrollAnimationTrigger>(*m_animation->trigger().get());
+                auto& scrollTrigger = downcast<ScrollAnimationTrigger>(*m_animation->trigger());
                 if (currentScrollPosition >= scrollTrigger.startValue().value() && (!scrollTrigger.hasEndValue() || currentScrollPosition <= scrollTrigger.endValue().value()))
                     return 0;
             }
@@ -653,7 +653,7 @@ double AnimationBase::progress(double scale, double offset, const TimingFunction
     }
 
     if (!timingFunction)
-        timingFunction = m_animation->timingFunction().get();
+        timingFunction = m_animation->timingFunction();
 
     switch (timingFunction->type()) {
     case TimingFunction::CubicBezierFunction: {
@@ -743,7 +743,7 @@ double AnimationBase::getElapsedTime() const
 {
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
     if (m_animation->trigger() && m_animation->trigger()->isScrollAnimationTrigger()) {
-        ScrollAnimationTrigger& scrollTrigger = downcast<ScrollAnimationTrigger>(*m_animation->trigger().get());
+        auto& scrollTrigger = downcast<ScrollAnimationTrigger>(*m_animation->trigger());
         if (scrollTrigger.hasEndValue() && m_object) {
             float offset = m_compositeAnimation->animationController().scrollPosition();
             float startValue = scrollTrigger.startValue().value();
index 2d89404..9f6b917 100644 (file)
@@ -90,8 +90,7 @@ static inline Length blendFunc(const AnimationBase*, const Length& from, const L
 
 static inline LengthSize blendFunc(const AnimationBase* anim, const LengthSize& from, const LengthSize& to, double progress)
 {
-    return LengthSize(blendFunc(anim, from.width(), to.width(), progress),
-                      blendFunc(anim, from.height(), to.height(), progress));
+    return { blendFunc(anim, from.width, to.width, progress), blendFunc(anim, from.height, to.height, progress) };
 }
 
 static inline ShadowStyle blendFunc(const AnimationBase* anim, ShadowStyle from, ShadowStyle to, double progress)
@@ -492,7 +491,7 @@ template <typename T>
 class LengthPropertyWrapper : public PropertyWrapperGetter<const T&> {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    LengthPropertyWrapper(CSSPropertyID prop, const T& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T))
+    LengthPropertyWrapper(CSSPropertyID prop, const T& (RenderStyle::*getter)() const, void (RenderStyle::*setter)(T&&))
         : PropertyWrapperGetter<const T&>(prop, getter)
         , m_setter(setter)
     {
@@ -504,7 +503,7 @@ public:
     }
 
 protected:
-    void (RenderStyle::*m_setter)(T);
+    void (RenderStyle::*m_setter)(T&&);
 };
 
 class PropertyWrapperClipPath : public RefCountedPropertyWrapper<ClipPathOperation> {
@@ -1049,7 +1048,7 @@ public:
 class FillLayersPropertyWrapper : public AnimationPropertyWrapperBase {
     WTF_MAKE_FAST_ALLOCATED;
 public:
-    typedef const FillLayer* (RenderStyle::*LayersGetter)() const;
+    typedef const FillLayer& (RenderStyle::*LayersGetter)() const;
     typedef FillLayer& (RenderStyle::*LayersAccessor)();
 
     FillLayersPropertyWrapper(CSSPropertyID prop, LayersGetter getter, LayersAccessor accessor)
@@ -1086,8 +1085,8 @@ public:
         if (!a || !b)
             return false;
 
-        const FillLayer* fromLayer = (a->*m_layersGetter)();
-        const FillLayer* toLayer = (b->*m_layersGetter)();
+        auto* fromLayer = &(a->*m_layersGetter)();
+        auto* toLayer = &(b->*m_layersGetter)();
 
         while (fromLayer && toLayer) {
             if (!m_fillLayerPropertyWrapper->equals(fromLayer, toLayer))
@@ -1102,9 +1101,9 @@ public:
 
     void blend(const AnimationBase* anim, RenderStyle* dst, const RenderStyle* a, const RenderStyle* b, double progress) const override
     {
-        const FillLayer* aLayer = (a->*m_layersGetter)();
-        const FillLayer* bLayer = (b->*m_layersGetter)();
-        FillLayer* dstLayer = &(dst->*m_layersAccessor)();
+        auto* aLayer = &(a->*m_layersGetter)();
+        auto* bLayer = &(b->*m_layersGetter)();
+        auto* dstLayer = &(dst->*m_layersAccessor)();
 
         while (aLayer && bLayer && dstLayer) {
             m_fillLayerPropertyWrapper->blend(anim, dstLayer, aLayer, bLayer, progress);
index ed96ab1..22bde46 100644 (file)
@@ -99,28 +99,28 @@ bool ScrollingCoordinator::coordinatesScrollingForFrameView(const FrameView& fra
 
 EventTrackingRegions ScrollingCoordinator::absoluteEventTrackingRegionsForFrame(const Frame& frame) const
 {
-    RenderView* renderView = frame.contentRenderer();
+    auto* renderView = frame.contentRenderer();
     if (!renderView || renderView->documentBeingDestroyed())
         return EventTrackingRegions();
 
 #if ENABLE(IOS_TOUCH_EVENTS)
     // On iOS, we use nonFastScrollableRegion to represent the region covered by elements with touch event handlers.
     ASSERT(frame.isMainFrame());
-
-    Document* document = frame.document();
+    auto* document = frame.document();
     if (!document)
         return EventTrackingRegions();
     return document->eventTrackingRegions();
 #else
-    Region nonFastScrollableRegion;
-    FrameView* frameView = frame.view();
+    auto* frameView = frame.view();
     if (!frameView)
         return EventTrackingRegions();
 
+    Region nonFastScrollableRegion;
+
     // FIXME: should ASSERT(!frameView->needsLayout()) here, but need to fix DebugPageOverlays
     // to not ask for regions at bad times.
 
-    if (const FrameView::ScrollableAreaSet* scrollableAreas = frameView->scrollableAreas()) {
+    if (auto* scrollableAreas = frameView->scrollableAreas()) {
         for (auto& scrollableArea : *scrollableAreas) {
             // Composited scrollable areas can be scrolled off the main thread.
             if (scrollableArea->usesAsyncScrolling())
@@ -136,18 +136,21 @@ EventTrackingRegions ScrollingCoordinator::absoluteEventTrackingRegionsForFrame(
     }
 
     for (auto& widget : frameView->widgetsInRenderTree()) {
-        RenderWidget* renderWidget = RenderWidget::find(widget);
-        if (!renderWidget || !is<PluginViewBase>(*widget))
+        if (!is<PluginViewBase>(*widget))
             continue;
-    
-        if (downcast<PluginViewBase>(*widget).wantsWheelEvents())
-            nonFastScrollableRegion.unite(renderWidget->absoluteBoundingBoxRect());
+        if (!downcast<PluginViewBase>(*widget).wantsWheelEvents())
+            continue;
+        auto* renderWidget = RenderWidget::find(*widget);
+        if (!renderWidget)
+            continue;
+        nonFastScrollableRegion.unite(renderWidget->absoluteBoundingBoxRect());
     }
     
-    // FIXME: if we've already accounted for this subframe as a scrollable area, we can avoid recursing into it here.
     EventTrackingRegions eventTrackingRegions;
+
+    // FIXME: if we've already accounted for this subframe as a scrollable area, we can avoid recursing into it here.
     for (Frame* subframe = frame.tree().firstChild(); subframe; subframe = subframe->tree().nextSibling()) {
-        FrameView* subframeView = subframe->view();
+        auto* subframeView = subframe->view();
         if (!subframeView)
             continue;
 
@@ -160,7 +163,7 @@ EventTrackingRegions ScrollingCoordinator::absoluteEventTrackingRegionsForFrame(
         eventTrackingRegions.unite(subframeRegion);
     }
 
-    Document::RegionFixedPair wheelHandlerRegion = frame.document()->absoluteRegionForEventTargets(frame.document()->wheelEventTargets());
+    auto wheelHandlerRegion = frame.document()->absoluteRegionForEventTargets(frame.document()->wheelEventTargets());
     bool wheelHandlerInFixedContent = wheelHandlerRegion.second;
     if (wheelHandlerInFixedContent) {
         // FIXME: need to handle position:sticky here too.
@@ -172,6 +175,7 @@ EventTrackingRegions ScrollingCoordinator::absoluteEventTrackingRegionsForFrame(
 
     // FIXME: If this is not the main frame, we could clip the region to the frame's bounds.
     eventTrackingRegions.uniteSynchronousRegion(eventNames().wheelEvent, nonFastScrollableRegion);
+
     return eventTrackingRegions;
 #endif
 }
index 9e70e9d..b11164f 100644 (file)
@@ -23,8 +23,7 @@
  * THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef KeyedCoding_h
-#define KeyedCoding_h
+#pragma once
 
 #include <functional>
 #include <wtf/Forward.h>
@@ -156,7 +155,7 @@ public:
     virtual void encodeDouble(const String& key, double) = 0;
     virtual void encodeString(const String& key, const String&) = 0;
 
-    virtual PassRefPtr<SharedBuffer> finishEncoding() = 0;
+    virtual RefPtr<SharedBuffer> finishEncoding() = 0;
 
     template<typename T>
     void encodeEnum(const String& key, T value)
@@ -211,5 +210,3 @@ private:
 };
 
 } // namespace WebCore
-
-#endif // KeyedCoding_h
index e7a978a..3e0f218 100644 (file)
@@ -19,8 +19,7 @@
     Boston, MA 02110-1301, USA.
 */
 
-#ifndef LengthBox_h
-#define LengthBox_h
+#pragma once
 
 #include "Length.h"
 #include "WritingMode.h"
@@ -31,12 +30,17 @@ namespace WebCore {
 template<typename T> class BoxExtent {
 public:
     BoxExtent()
-        : m_sides({{ T(0), T(0), T(0), T(0) }})
+        : m_sides({ { { 0 }, { 0 }, { 0 }, { 0 } } })
     {
     }
 
     BoxExtent(const T& top, const T& right, const T& bottom, const T& left)
-        : m_sides({{ top, right, bottom, left }})
+        : m_sides({ { top, right, bottom, left } })
+    {
+    }
+
+    BoxExtent(T&& top, T&& right, T&& bottom, T&& left)
+        : m_sides({ { std::forward<T>(top), std::forward<T>(right), std::forward<T>(bottom), std::forward<T>(left) } })
     {
     }
 
@@ -139,8 +143,8 @@ public:
     {
     }
 
-    LengthBox(const Length& top, const Length& right, const Length& bottom, const Length& left)
-        : BoxExtent(top, right, bottom, left)
+    LengthBox(Length&& top, Length&& right, Length&& bottom, Length&& left)
+        : BoxExtent { WTFMove(top), WTFMove(right), WTFMove(bottom), WTFMove(left) }
     {
     }
 
@@ -150,11 +154,9 @@ public:
     }
 };
 
-typedef BoxExtent<LayoutUnit> LayoutBoxExtent;
-typedef BoxExtent<float> FloatBoxExtent;
+using LayoutBoxExtent = BoxExtent<LayoutUnit>;
+using FloatBoxExtent = BoxExtent<float>;
 
 TextStream& operator<<(TextStream&, const LengthBox&);
 
 } // namespace WebCore
-
-#endif // LengthBox_h
index 16839cc..7f350e7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2015 Apple Inc.  All rights reserved.
+ * Copyright (C) 2015 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -32,7 +32,7 @@ namespace WebCore {
 
 TextStream& operator<<(TextStream& ts, const LengthSize& size)
 {
-    return ts << size.width() << " " << size.height();
+    return ts << size.width << " " << size.height;
 }
 
 } // namespace WebCore
index d713e18..60523ee 100644 (file)
@@ -1,6 +1,5 @@
 /*
-    Copyright (C) 1999 Lars Knoll (knoll@kde.org)
-    Copyright (C) 2006, 2008 Apple Inc. All rights reserved.
+    Copyright (C) 2006-2017 Apple Inc. All rights reserved.
 
     This library is free software; you can redistribute it and/or
     modify it under the terms of the GNU Library General Public
     Boston, MA 02110-1301, USA.
 */
 
-#ifndef LengthSize_h
-#define LengthSize_h
+#pragma once
 
 #include "Length.h"
 
 namespace WebCore {
 
 struct LengthSize {
-public:
-    LengthSize()
-    {
-    }
-    
-    LengthSize(Length width, Length height)
-        : m_width(WTFMove(width))
-        , m_height(WTFMove(height))
-    {
-    }
-
-    bool operator==(const LengthSize& o) const
-    {
-        return m_width == o.m_width && m_height == o.m_height;
-    }
-
-    void setWidth(Length width) { m_width = WTFMove(width); }
-    const Length& width() const { return m_width; }
-
-    void setHeight(Length height) { m_height = WTFMove(height); }
-    const Length& height() const { return m_height; }
-
-private:
-    Length m_width;
-    Length m_height;
+    Length width;
+    Length height;
 };
 
+inline bool operator==(const LengthSize& a, const LengthSize& b)
+{
+    return a.width == b.width && a.height == b.height;
+}
+
 inline LengthSize blend(const LengthSize& from, const LengthSize& to, double progress)
 {
-    return LengthSize(blend(from.width(), to.width(), progress), blend(from.height(), to.height(), progress));
+    return { blend(from.width, to.width, progress), blend(from.height, to.height, progress) };
 }
 
 TextStream& operator<<(TextStream&, const LengthSize&);
 
 } // namespace WebCore
-
-#endif // LengthSize_h
diff --git a/Source/WebCore/platform/PlatformSpeechSynthesis.h b/Source/WebCore/platform/PlatformSpeechSynthesis.h
deleted file mode 100644 (file)
index 1434001..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/*
- * Copyright (C) 2013 Apple Inc.  All rights reserved.
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- * 1. Redistributions of source code must retain the above copyright
- *    notice, this list of conditions and the following disclaimer.
- * 2. Redistributions in binary form must reproduce the above copyright
- *    notice, this list of conditions and the following disclaimer in the
- *    documentation and/or other materials provided with the distribution.
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
- * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
- * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
- * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
- * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
- * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
- * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
- * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
- * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#ifndef PlatformSpeechSynthesis_h
-#define PlatformSpeechSynthesis_h
-
-#if ENABLE(SPEECH_SYNTHESIS)
-
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/Vector.h>
-
-namespace WebCore {
-    
-class SpeechSynthesis;
-class SpeechSynthesisUtterance;
-class SpeechSynthesisVoice;
-    
-class PlatformSpeechSynthesis : public RefCounted<PlatformSpeechSynthesis> {
-public:
-    static PassRefPtr<PlatformSpeechSynthesis> create(SpeechSynthesis*);
-    
-    void platformInitializeVoiceList(Vector<RefPtr<SpeechSynthesisVoice> >&);
-    void platformSpeak(SpeechSynthesisUtterance*);
-    
-private:
-    PlatformSpeechSynthesis(SpeechSynthesis*);
-
-    SpeechSynthesis* m_speechSynthesis;
-};
-    
-} // namespace WebCore
-
-#endif // ENABLE(SPEECH_SYNTHESIS)
-
-#endif // PlatformSpeechSynthesis_h
index 1f207f4..10a830e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc.  All rights reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 namespace WebCore {
 
-PassRefPtr<PlatformSpeechSynthesisUtterance> PlatformSpeechSynthesisUtterance::create(PlatformSpeechSynthesisUtteranceClient* client)
+Ref<PlatformSpeechSynthesisUtterance> PlatformSpeechSynthesisUtterance::create(PlatformSpeechSynthesisUtteranceClient& client)
 {
-    return adoptRef(new PlatformSpeechSynthesisUtterance(client));
+    return adoptRef(*new PlatformSpeechSynthesisUtterance(client));
 }
     
-PlatformSpeechSynthesisUtterance::PlatformSpeechSynthesisUtterance(PlatformSpeechSynthesisUtteranceClient* client)
-    : m_client(client)
-    , m_volume(1.0f)
-    , m_rate(1.0f)
-    , m_pitch(1.0f)
+inline PlatformSpeechSynthesisUtterance::PlatformSpeechSynthesisUtterance(PlatformSpeechSynthesisUtteranceClient& client)
+    : m_client(&client)
 {
 }
     
index a869bb8..e08775b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc.  All rights reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef PlatformSpeechSynthesisUtterance_h
-#define PlatformSpeechSynthesisUtterance_h
+#pragma once
 
 #if ENABLE(SPEECH_SYNTHESIS)
 
 #include "PlatformSpeechSynthesisVoice.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
 
 namespace WebCore {
     
 class PlatformSpeechSynthesisUtteranceClient {
-public:
-    // Implement methods as needed.
-protected:
-    virtual ~PlatformSpeechSynthesisUtteranceClient() { }
 };
     
 class PlatformSpeechSynthesisUtterance : public RefCounted<PlatformSpeechSynthesisUtterance> {
 public:
-    static PassRefPtr<PlatformSpeechSynthesisUtterance> create(PlatformSpeechSynthesisUtteranceClient*);
-    
+    static Ref<PlatformSpeechSynthesisUtterance> create(PlatformSpeechSynthesisUtteranceClient&);
+
     const String& text() const { return m_text; }
     void setText(const String& text) { m_text = text; }
     
@@ -74,20 +66,18 @@ public:
     void setClient(PlatformSpeechSynthesisUtteranceClient* client) { m_client = client; }
     
 private:
-    explicit PlatformSpeechSynthesisUtterance(PlatformSpeechSynthesisUtteranceClient*);
+    explicit PlatformSpeechSynthesisUtterance(PlatformSpeechSynthesisUtteranceClient&);
 
     PlatformSpeechSynthesisUtteranceClient* m_client;
     String m_text;
     String m_lang;
     RefPtr<PlatformSpeechSynthesisVoice> m_voice;
-    float m_volume;
-    float m_rate;
-    float m_pitch;
-    double m_startTime;
+    float m_volume { 1 };
+    float m_rate { 1 };
+    float m_pitch { 1 };
+    double m_startTime { 0 };
 };
     
 } // namespace WebCore
 
 #endif // ENABLE(SPEECH_SYNTHESIS)
-
-#endif // PlatformSpeechSynthesisUtterance_h
index 580f19d..24376cd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc.  All rights reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 namespace WebCore {
 
-PassRefPtr<PlatformSpeechSynthesisVoice> PlatformSpeechSynthesisVoice::create(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault)
+Ref<PlatformSpeechSynthesisVoice> PlatformSpeechSynthesisVoice::create(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault)
 {
-    return adoptRef(new PlatformSpeechSynthesisVoice(voiceURI, name, lang, localService, isDefault));
+    return adoptRef(*new PlatformSpeechSynthesisVoice(voiceURI, name, lang, localService, isDefault));
 }
 
-PassRefPtr<PlatformSpeechSynthesisVoice> PlatformSpeechSynthesisVoice::create()
+Ref<PlatformSpeechSynthesisVoice> PlatformSpeechSynthesisVoice::create()
 {
-    return adoptRef(new PlatformSpeechSynthesisVoice());
+    return adoptRef(*new PlatformSpeechSynthesisVoice);
 }
-    
-PlatformSpeechSynthesisVoice::PlatformSpeechSynthesisVoice(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault)
+
+inline PlatformSpeechSynthesisVoice::PlatformSpeechSynthesisVoice(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault)
     : m_voiceURI(voiceURI)
     , m_name(name)
     , m_lang(lang)
@@ -49,12 +49,6 @@ PlatformSpeechSynthesisVoice::PlatformSpeechSynthesisVoice(const String& voiceUR
 {
 }
 
-PlatformSpeechSynthesisVoice::PlatformSpeechSynthesisVoice()
-    : m_localService(false)
-    , m_default(false)
-{
-}
-
 } // namespace WebCore
 
 #endif // ENABLE(SPEECH_SYNTHESIS)
index 343b9e7..0158b34 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2013 Apple Inc.  All rights reserved.
+ * Copyright (C) 2013 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef PlatformSpeechSynthesisVoice_h
-#define PlatformSpeechSynthesisVoice_h
+#pragma once
 
 #if ENABLE(SPEECH_SYNTHESIS)
 
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
 #include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
 class PlatformSpeechSynthesisVoice : public RefCounted<PlatformSpeechSynthesisVoice> {
 public:
-    WEBCORE_EXPORT static PassRefPtr<PlatformSpeechSynthesisVoice> create(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault);
-    static PassRefPtr<PlatformSpeechSynthesisVoice> create();
+    WEBCORE_EXPORT static Ref<PlatformSpeechSynthesisVoice> create(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault);
+    static Ref<PlatformSpeechSynthesisVoice> create();
 
     const String& voiceURI() const { return m_voiceURI; }
     void setVoiceURI(const String& voiceURI) { m_voiceURI = voiceURI; }
@@ -56,17 +53,15 @@ public:
 
 private:
     PlatformSpeechSynthesisVoice(const String& voiceURI, const String& name, const String& lang, bool localService, bool isDefault);
-    PlatformSpeechSynthesisVoice();
+    PlatformSpeechSynthesisVoice() = default;
 
     String m_voiceURI;
     String m_name;
     String m_lang;
-    bool m_localService;
-    bool m_default;
+    bool m_localService { false };
+    bool m_default { false };
 };
 
 } // namespace WebCore
 
 #endif // ENABLE(SPEECH_SYNTHESIS)
-
-#endif // PlatformSpeechSynthesisVoice_h
index cbffe6e..b89d566 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006, 2007, 2008, 2014-2015 Apple Inc. All rights reserved.
+ * Copyright (C) 2006-2017 Apple Inc. All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -62,14 +62,14 @@ ScrollView::~ScrollView()
 {
 }
 
-void ScrollView::addChild(PassRefPtr<Widget> prpChild) 
+void ScrollView::addChild(Widget& child)
 {
-    Widget* child = prpChild.get();
-    ASSERT(child != this && !child->parent());
-    child->setParent(this);
-    m_children.add(prpChild);
-    if (child->platformWidget())
-        platformAddChild(child);
+    ASSERT(&child != this);
+    ASSERT(!child.parent());
+    child.setParent(this);
+    m_children.add(child);
+    if (child.platformWidget())
+        platformAddChild(&child);
 }
 
 void ScrollView::removeChild(Widget& child)
@@ -97,7 +97,7 @@ bool ScrollView::setHasScrollbarInternal(RefPtr<Scrollbar>& scrollbar, Scrollbar
 
     if (hasBar && !scrollbar) {
         scrollbar = createScrollbar(orientation);
-        addChild(scrollbar.get());
+        addChild(*scrollbar);
         didAddScrollbar(scrollbar.get(), orientation);
         scrollbar->styleChanged();
         if (contentSizeAffected)
@@ -829,12 +829,6 @@ void ScrollView::scrollContents(const IntSize& scrollDelta)
     window->invalidateRootView(IntRect());
 }
 
-bool ScrollView::scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect)
-{
-    hostWindow()->scroll(scrollDelta, rectToScroll, clipRect);
-    return true;
-}
-
 void ScrollView::scrollContentsSlowPath(const IntRect& updateRect)
 {
     hostWindow()->invalidateContentsForSlowScroll(updateRect);
@@ -1038,17 +1032,14 @@ void ScrollView::frameRectsChanged()
 {
     if (platformWidget())
         return;
-
-    HashSet<RefPtr<Widget>>::const_iterator end = m_children.end();
-    for (HashSet<RefPtr<Widget>>::const_iterator current = m_children.begin(); current != end; ++current)
-        (*current)->frameRectsChanged();
+    for (auto& child : m_children)
+        child->frameRectsChanged();
 }
 
 void ScrollView::clipRectChanged()
 {
-    HashSet<RefPtr<Widget>>::const_iterator end = m_children.end();
-    for (HashSet<RefPtr<Widget>>::const_iterator current = m_children.begin(); current != end; ++current)
-        (*current)->clipRectChanged();
+    for (auto& child : m_children)
+        child->clipRectChanged();
 }
 
 static void positionScrollbarLayer(GraphicsLayer* graphicsLayer, Scrollbar* scrollbar)
@@ -1150,10 +1141,6 @@ void ScrollView::scrollbarStyleChanged(ScrollbarStyle newStyle, bool forceUpdate
     positionScrollbarLayers();
 }
 
-void ScrollView::updateScrollCorner()
-{
-}
-
 void ScrollView::paintScrollCorner(GraphicsContext& context, const IntRect& cornerRect)
 {
     ScrollbarTheme::theme().paintScrollCorner(this, context, cornerRect);
@@ -1392,9 +1379,8 @@ void ScrollView::setParentVisible(bool visible)
     if (!isSelfVisible())
         return;
         
-    HashSet<RefPtr<Widget>>::iterator end = m_children.end();
-    for (HashSet<RefPtr<Widget>>::iterator it = m_children.begin(); it != end; ++it)
-        (*it)->setParentVisible(visible);
+    for (auto& child : m_children)
+        child->setParentVisible(visible);
 }
 
 void ScrollView::show()
@@ -1402,9 +1388,8 @@ void ScrollView::show()
     if (!isSelfVisible()) {
         setSelfVisible(true);
         if (isParentVisible()) {
-            HashSet<RefPtr<Widget>>::iterator end = m_children.end();
-            for (HashSet<RefPtr<Widget>>::iterator it = m_children.begin(); it != end; ++it)
-                (*it)->setParentVisible(true);
+            for (auto& child : m_children)
+                child->setParentVisible(true);
         }
     }
 
@@ -1415,9 +1400,8 @@ void ScrollView::hide()
 {
     if (isSelfVisible()) {
         if (isParentVisible()) {
-            HashSet<RefPtr<Widget>>::iterator end = m_children.end();
-            for (HashSet<RefPtr<Widget>>::iterator it = m_children.begin(); it != end; ++it)
-                (*it)->setParentVisible(false);
+            for (auto& child : m_children)
+                child->setParentVisible(false);
         }
         setSelfVisible(false);
     }
index db570dd..6b31f98 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2004, 2006, 2007, 2008, 2013, 2014 Apple Inc. All rights reserved.
+ * Copyright (C) 2004-2017 Apple Inc. All rights reserved.
  * Copyright (C) 2009 Holger Hans Peter Freyther
  *
  * Redistribution and use in source and binary forms, with or without
 #include "ScrollableArea.h"
 #include "ScrollTypes.h"
 #include "Widget.h"
-
 #include <wtf/HashSet.h>
 
 #if PLATFORM(IOS)
+
 OBJC_CLASS WAKScrollView;
 OBJC_CLASS WAKView;
 
@@ -46,6 +46,7 @@ OBJC_CLASS WAKView;
 #ifndef NSView
 #define NSView WAKView
 #endif
+
 #endif // PLATFORM(IOS)
 
 #if PLATFORM(COCOA) && defined __OBJC__
@@ -64,10 +65,10 @@ public:
     virtual ~ScrollView();
 
     // ScrollableArea functions.
-    int scrollSize(ScrollbarOrientation) const override;
-    int scrollOffset(ScrollbarOrientation) const override;
-    WEBCORE_EXPORT void setScrollOffset(const ScrollOffset&) override;
-    bool isScrollCornerVisible() const override;
+    int scrollSize(ScrollbarOrientation) const final;
+    int scrollOffset(ScrollbarOrientation) const final;
+    WEBCORE_EXPORT void setScrollOffset(const ScrollOffset&) final;
+    bool isScrollCornerVisible() const final;
     void scrollbarStyleChanged(ScrollbarStyle, bool forceUpdate) override;
 
     virtual void notifyPageThatContentAreaWillPaint() const;
@@ -85,14 +86,14 @@ public:
     virtual IntRect windowClipRect() const = 0;
 
     // Functions for child manipulation and inspection.
-    const HashSet<RefPtr<Widget>>& children() const { return m_children; }
-    WEBCORE_EXPORT virtual void addChild(PassRefPtr<Widget>);
+    const HashSet<Ref<Widget>>& children() const { return m_children; }
+    WEBCORE_EXPORT void addChild(Widget&);
     virtual void removeChild(Widget&);
 
     // If the scroll view does not use a native widget, then it will have cross-platform Scrollbars. These functions
     // can be used to obtain those scrollbars.
-    Scrollbar* horizontalScrollbar() const override { return m_horizontalScrollbar.get(); }
-    Scrollbar* verticalScrollbar() const override { return m_verticalScrollbar.get(); }
+    Scrollbar* horizontalScrollbar() const final { return m_horizontalScrollbar.get(); }
+    Scrollbar* verticalScrollbar() const final { return m_verticalScrollbar.get(); }
     bool isScrollViewScrollbar(const Widget* child) const { return horizontalScrollbar() == child || verticalScrollbar() == child; }
 
     void positionScrollbarLayers();
@@ -121,7 +122,7 @@ public:
 
     virtual bool avoidScrollbarCreation() const { return false; }
 
-    void setScrollbarOverlayStyle(ScrollbarOverlayStyle) override;
+    void setScrollbarOverlayStyle(ScrollbarOverlayStyle) final;
 
     // By default you only receive paint events for the area that is visible. In the case of using a
     // tiled backing store, this function can be set, so that the view paints the entire contents.
@@ -167,7 +168,7 @@ public:
     // In the situation the client is responsible for the scrolling (ie. with a tiled backing store) it is possible to use
     // the setFixedVisibleContentRect instead for the mainframe, though this must be updated manually, e.g just before resuming the page
     // which usually will happen when panning, pinching and rotation ends, or when scale or position are changed manually.
-    IntSize visibleSize() const override { return visibleContentRect(LegacyIOSDocumentVisibleRect).size(); }
+    IntSize visibleSize() const final { return visibleContentRect(LegacyIOSDocumentVisibleRect).size(); }
 
 #if USE(COORDINATED_GRAPHICS)
     virtual void setFixedVisibleContentRect(const IntRect& visibleContentRect) { m_fixedVisibleContentRect = visibleContentRect; }
@@ -217,13 +218,13 @@ public:
 
     // Functions for getting/setting the size of the document contained inside the ScrollView (as an IntSize or as individual width and height
     // values).
-    WEBCORE_EXPORT IntSize contentsSize() const override; // Always at least as big as the visibleWidth()/visibleHeight().
+    WEBCORE_EXPORT IntSize contentsSize() const final; // Always at least as big as the visibleWidth()/visibleHeight().
     int contentsWidth() const { return contentsSize().width(); }
     int contentsHeight() const { return contentsSize().height(); }
     virtual void setContentsSize(const IntSize&);
 
     // Functions for querying the current scrolled position (both as a point, a size, or as individual X and Y values).
-    ScrollPosition scrollPosition() const override { return visibleContentRect(LegacyIOSDocumentVisibleRect).location(); }
+    ScrollPosition scrollPosition() const final { return visibleContentRect(LegacyIOSDocumentVisibleRect).location(); }
 
     ScrollPosition maximumScrollPosition() const override; // The maximum position we can be scrolled to.
 
@@ -258,7 +259,7 @@ public:
     // relative to the very top of the view.
     WEBCORE_EXPORT ScrollPosition documentScrollPositionRelativeToViewOrigin() const;
 
-    IntSize overhangAmount() const override;
+    IntSize overhangAmount() const final;
 
     void cacheCurrentScrollPosition() { m_cachedScrollPosition = scrollPosition(); }
     ScrollPosition cachedScrollPosition() const { return m_cachedScrollPosition; }
@@ -313,13 +314,13 @@ public:
     bool isOffscreen() const;
 
     // Called when our frame rect changes (or the rect/scroll position of an ancestor changes).
-    void frameRectsChanged() override;
+    void frameRectsChanged() final;
     
     // Widget override to update our scrollbars and notify our contents of the resize.
     void setFrameRect(const IntRect&) override;
 
     // Widget override to notify our contents of a cliprect change.
-    void clipRectChanged() override;
+    void clipRectChanged() final;
 
     // For platforms that need to hit test scrollbars from within the engine's event handlers (like Win32).
     Scrollbar* scrollbarAtPoint(const IntPoint& windowPoint);
@@ -343,13 +344,13 @@ public:
     }
 
     // Widget override. Handles painting of the contents of the view as well as the scrollbars.
-    WEBCORE_EXPORT void paint(GraphicsContext&, const IntRect&) override;
+    WEBCORE_EXPORT void paint(GraphicsContext&, const IntRect&) final;
     void paintScrollbars(GraphicsContext&, const IntRect&);
 
     // Widget overrides to ensure that our children's visibility status is kept up to date when we get shown and hidden.
     WEBCORE_EXPORT void show() override;
-    WEBCORE_EXPORT void hide() override;
-    WEBCORE_EXPORT void setParentVisible(bool) override;
+    WEBCORE_EXPORT void hide() final;
+    WEBCORE_EXPORT void setParentVisible(bool) final;
     
     // Pan scrolling.
     static const int noPanScrollRadius = 15;
@@ -357,21 +358,19 @@ public:
     void removePanScrollIcon();
     void paintPanScrollIcon(GraphicsContext&);
 
-    virtual bool isPointInScrollbarCorner(const IntPoint&);
-    virtual bool scrollbarCornerPresent() const;
-    IntRect scrollCornerRect() const override;
+    bool isPointInScrollbarCorner(const IntPoint&);
+    bool scrollbarCornerPresent() const;
+    IntRect scrollCornerRect() const final;
     virtual void paintScrollCorner(GraphicsContext&, const IntRect& cornerRect);
     virtual void paintScrollbar(GraphicsContext&, Scrollbar&, const IntRect&);
 
-    IntRect convertFromScrollbarToContainingView(const Scrollbar&, const IntRect&) const override;
-    IntRect convertFromContainingViewToScrollbar(const Scrollbar&, const IntRect&) const override;
-    IntPoint convertFromScrollbarToContainingView(const Scrollbar&, const IntPoint&) const override;
-    IntPoint convertFromContainingViewToScrollbar(const Scrollbar&, const IntPoint&) const override;
+    IntRect convertFromScrollbarToContainingView(const Scrollbar&, const IntRect&) const final;
+    IntRect convertFromContainingViewToScrollbar(const Scrollbar&, const IntRect&) const final;
+    IntPoint convertFromScrollbarToContainingView(const Scrollbar&, const IntPoint&) const final;
+    IntPoint convertFromContainingViewToScrollbar(const Scrollbar&, const IntPoint&) const final;
 
     void calculateAndPaintOverhangAreas(GraphicsContext&, const IntRect& dirtyRect);
 
-    bool isScrollView() const override { return true; }
-
     WEBCORE_EXPORT void scrollOffsetChangedViaPlatformWidget(const ScrollOffset& oldOffset, const ScrollOffset& newOffset);
 
 protected:
@@ -384,26 +383,26 @@ protected:
 
     void availableContentSizeChanged(AvailableSizeChangeReason) override;
     virtual void addedOrRemovedScrollbar() = 0;
-    virtual void delegatesScrollingDidChange() { }
+    virtual void delegatesScrollingDidChange() = 0;
 
     // These functions are used to create/destroy scrollbars.
     // They return true if the scrollbar was added or removed.
-    bool setHasHorizontalScrollbar(bool, bool* contentSizeAffected = 0);
-    bool setHasVerticalScrollbar(bool, bool* contentSizeAffected = 0);
+    bool setHasHorizontalScrollbar(bool, bool* contentSizeAffected = nullptr);
+    bool setHasVerticalScrollbar(bool, bool* contentSizeAffected = nullptr);
 
-    virtual void updateScrollCorner();
-    void invalidateScrollCornerRect(const IntRect&) override;
+    virtual void updateScrollCorner() = 0;
+    void invalidateScrollCornerRect(const IntRect&) final;
 
     // Scroll the content by blitting the pixels.
-    virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect);
+    virtual bool scrollContentsFastPath(const IntSize& scrollDelta, const IntRect& rectToScroll, const IntRect& clipRect) = 0;
     // Scroll the content by invalidating everything.
     virtual void scrollContentsSlowPath(const IntRect& updateRect);
 
     void setScrollOrigin(const IntPoint&, bool updatePositionAtAll, bool updatePositionSynchronously);
 
     // Subclassed by FrameView to check the writing-mode of the document.
-    virtual bool isVerticalDocument() const { return true; }
-    virtual bool isFlippedDocument() const { return false; }
+    virtual bool isVerticalDocument() const = 0;
+    virtual bool isFlippedDocument() const = 0;
 
     // Called to update the scrollbars to accurately reflect the state of the view.
     void updateScrollbars(const ScrollPosition& desiredPosition);
@@ -411,27 +410,29 @@ protected:
     float platformTopContentInset() const;
     void platformSetTopContentInset(float);
 
-    virtual void handleDeferredScrollUpdateAfterContentSizeChange();
+    void handleDeferredScrollUpdateAfterContentSizeChange();
 
-    virtual bool shouldDeferScrollUpdateAfterContentSizeChange() { return false; }
+    virtual bool shouldDeferScrollUpdateAfterContentSizeChange() = 0;
 
-    virtual void scrollOffsetChangedViaPlatformWidgetImpl(const ScrollOffset&, const ScrollOffset&) { }
+    virtual void scrollOffsetChangedViaPlatformWidgetImpl(const ScrollOffset&, const ScrollOffset&) = 0;
 
 #if PLATFORM(IOS)
-    virtual void unobscuredContentSizeChanged() { }
+    virtual void unobscuredContentSizeChanged() = 0;
 #endif
 
 private:
     // Size available for view contents, excluding content insets. Not affected by zooming.
     IntSize sizeForUnobscuredContent(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
 
-    IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const override;
+    IntRect visibleContentRectInternal(VisibleContentRectIncludesScrollbars, VisibleContentRectBehavior) const final;
     WEBCORE_EXPORT IntRect unobscuredContentRectInternal(VisibleContentRectIncludesScrollbars = ExcludeScrollbars) const;
 
     void completeUpdatesAfterScrollTo(const IntSize& scrollDelta);
 
     bool setHasScrollbarInternal(RefPtr<Scrollbar>&, ScrollbarOrientation, bool hasBar, bool* contentSizeAffected);
 
+    bool isScrollView() const final { return true; }
+
     RefPtr<Scrollbar> m_horizontalScrollbar;
     RefPtr<Scrollbar> m_verticalScrollbar;
     ScrollbarMode m_horizontalScrollbarMode;
@@ -442,7 +443,7 @@ private:
 
     bool m_prohibitsScrolling;
 
-    HashSet<RefPtr<Widget>> m_children;
+    HashSet<Ref<Widget>> m_children;
 
     // This bool is unused on Mac OS because we directly ask the platform widget
     // whether it is safe to blit on scroll.
@@ -483,9 +484,9 @@ private:
 
     IntRect rectToCopyOnScroll() const;
 
-    // Called when the scroll position within this view changes.  FrameView overrides this to generate repaint invalidations.
-    virtual void updateLayerPositionsAfterScrolling() { }
-    virtual void updateCompositingLayersAfterScrolling() { }
+    // Called when the scroll position within this view changes. FrameView overrides this to generate repaint invalidations.
+    virtual void updateLayerPositionsAfterScrolling() = 0;
+    virtual void updateCompositingLayersAfterScrolling() = 0;
 
     void platformAddChild(Widget*);
     void platformRemoveChild(Widget*);
index 5911978..314a8df 100644 (file)
@@ -90,7 +90,7 @@ public:
     virtual LengthSize controlSize(ControlPart, const FontCascade&, const LengthSize& zoomedSize, float /*zoomFactor*/) const { return zoomedSize; }
     
     // Returns the minimum size for a control in zoomed coordinates.  
-    virtual LengthSize minimumControlSize(ControlPart, const FontCascade&, float /*zoomFactor*/) const { return LengthSize(Length(0, Fixed), Length(0, Fixed)); }
+    virtual LengthSize minimumControlSize(ControlPart, const FontCascade&, float /*zoomFactor*/) const { return { { 0, Fixed }, { 0, Fixed } }; }
     
     // Allows the theme to modify the existing padding/border.
     virtual LengthBox controlPadding(ControlPart, const FontCascade&, const LengthBox& zoomedBox, float zoomFactor) const;
index 9a0df17..8f5ad93 100644 (file)
@@ -2,7 +2,7 @@
  * Copyright (C) 2000 Lars Knoll (knoll@kde.org)
  *           (C) 2000 Antti Koivisto (koivisto@kde.org)
  *           (C) 2000 Dirk Mueller (mueller@kde.org)
- * Copyright (C) 2003, 2005, 2006, 2007, 2008 Apple Inc. All rights reserved.
+ * Copyright (C) 2003-2017 Apple Inc. All rights reserved.
  * Copyright (C) 2006 Graham Dennis (graham.dennis@gmail.com)
  *
  * This library is free software; you can redistribute it and/or
  *
  */
 
-#ifndef Animation_h
-#define Animation_h
+#pragma once
 
-#include "PlatformExportMacros.h"
-
-#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
-#include "AnimationTrigger.h"
-#endif
 #include "CSSPropertyNames.h"
 #include "RenderStyleConstants.h"
 #include "StyleScope.h"
 #include "TimingFunction.h"
-#include <wtf/PassRefPtr.h>
-#include <wtf/RefCounted.h>
-#include <wtf/text/WTFString.h>
+
+#if ENABLE(CSS_ANIMATIONS_LEVEL_2)
+#include "AnimationTrigger.h"
+#endif
 
 namespace WebCore {
 
@@ -62,20 +57,20 @@ public:
 
     // Flags this to be the special "none" animation (animation-name: none)
     bool isNoneAnimation() const { return m_isNone; }
+
     // We can make placeholder Animation objects to keep the comma-separated lists
     // of properties in sync. isValidAnimation means this is not a placeholder.
     bool isValidAnimation() const { return !m_isNone && !m_name.isEmpty(); }
 
     bool isEmpty() const
     {
-        return (!m_directionSet && !m_durationSet && !m_fillModeSet
-                && !m_nameSet && !m_playStateSet && !m_iterationCountSet
-                && !m_delaySet && !m_timingFunctionSet && !m_propertySet
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
-                && !m_triggerSet);
-#else
-                );
+        if (m_triggerSet)
+            return false;
 #endif
+        return !m_directionSet && !m_durationSet && !m_fillModeSet
+            && !m_nameSet && !m_playStateSet && !m_iterationCountSet
+            && !m_delaySet && !m_timingFunctionSet && !m_propertySet;
     }
 
     bool isEmptyOrZeroDuration() const
@@ -114,11 +109,7 @@ public:
 
     double delay() const { return m_delay; }
 
-    enum AnimationMode {
-        AnimateAll,
-        AnimateNone,
-        AnimateSingleProperty
-    };
+    enum AnimationMode { AnimateAll, AnimateNone, AnimateSingleProperty };
 
     enum AnimationDirection {
         AnimationDirectionNormal,
@@ -139,10 +130,10 @@ public:
     Style::ScopeOrdinal nameStyleScopeOrdinal() const { return m_nameStyleScopeOrdinal; }
     EAnimPlayState playState() const { return static_cast<EAnimPlayState>(m_playState); }
     CSSPropertyID property() const { return m_property; }
-    PassRefPtr<TimingFunction> timingFunction() const { return m_timingFunction; }
+    TimingFunction* timingFunction() const { return m_timingFunction.get(); }
     AnimationMode animationMode() const { return m_mode; }
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
-    PassRefPtr<AnimationTrigger> trigger() const { return m_trigger; }
+    AnimationTrigger* trigger() const { return m_trigger.get(); }
 #endif
 
     void setDelay(double c) { m_delay = c; m_delaySet = true; }
@@ -158,10 +149,10 @@ public:
     }
     void setPlayState(EAnimPlayState d) { m_playState = d; m_playStateSet = true; }
     void setProperty(CSSPropertyID t) { m_property = t; m_propertySet = true; }
-    void setTimingFunction(PassRefPtr<TimingFunction> f) { m_timingFunction = f; m_timingFunctionSet = true; }
+    void setTimingFunction(RefPtr<TimingFunction>&& function) { m_timingFunction = WTFMove(function); m_timingFunctionSet = true; }
     void setAnimationMode(AnimationMode mode) { m_mode = mode; }
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
-    void setTrigger(PassRefPtr<AnimationTrigger> t) { m_trigger = t; m_triggerSet = true; }
+    void setTrigger(RefPtr<AnimationTrigger>&& trigger) { m_trigger = WTFMove(trigger); m_triggerSet = true; }
 #endif
 
     void setIsNoneAnimation(bool n) { m_isNone = n; }
@@ -197,22 +188,22 @@ private:
     unsigned m_fillMode : 2;
 
 
-    unsigned m_playState     : 2;
+    unsigned m_playState : 2;
 
-    bool m_delaySet          : 1;
-    bool m_directionSet      : 1;
-    bool m_durationSet       : 1;
-    bool m_fillModeSet       : 1;
+    bool m_delaySet : 1;
+    bool m_directionSet : 1;
+    bool m_durationSet : 1;
+    bool m_fillModeSet : 1;
     bool m_iterationCountSet : 1;
-    bool m_nameSet           : 1;
-    bool m_playStateSet      : 1;
-    bool m_propertySet       : 1;
+    bool m_nameSet : 1;
+    bool m_playStateSet : 1;
+    bool m_propertySet : 1;
     bool m_timingFunctionSet : 1;
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
-    bool m_triggerSet        : 1;
+    bool m_triggerSet : 1;
 #endif
 
-    bool m_isNone            : 1;
+    bool m_isNone : 1;
 
 public:
     static double initialDelay() { return 0; }
@@ -223,12 +214,10 @@ public:
     static const String& initialName();
     static EAnimPlayState initialPlayState() { return AnimPlayStatePlaying; }
     static CSSPropertyID initialProperty() { return CSSPropertyInvalid; }
-    static const PassRefPtr<TimingFunction> initialTimingFunction() { return CubicBezierTimingFunction::create(); }
+    static Ref<TimingFunction> initialTimingFunction() { return CubicBezierTimingFunction::create(); }
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
-    static const PassRefPtr<AnimationTrigger> initialTrigger() { return AutoAnimationTrigger::create(); }
+    static Ref<AnimationTrigger> initialTrigger() { return AutoAnimationTrigger::create(); }
 #endif
 };
 
 } // namespace WebCore
-
-#endif // Animation_h
index 625d790..0a32022 100644 (file)
@@ -26,15 +26,16 @@ namespace WebCore {
 
 #define FILL_UNSET_PROPERTY(test, propGet, propSet) \
 for (i = 0; i < size() && animation(i).test(); ++i) { } \
-if (i < size() && i != 0) { \
+if (i) { \
     for (size_t j = 0; i < size(); ++i, ++j) \
         animation(i).propSet(animation(j).propGet()); \
 }
 
 AnimationList::AnimationList(const AnimationList& other)
 {
-    for (size_t i = 0; i < other.size(); ++i)
-        m_animations.append(Animation::create(other.animation(i)));
+    m_animations.reserveInitialCapacity(other.size());
+    for (auto& animation : other.m_animations)
+        m_animations.uncheckedAppend(Animation::create(animation.get()));
 }
 
 void AnimationList::fillUnsetProperties()
@@ -55,9 +56,10 @@ bool AnimationList::operator==(const AnimationList& other) const
 {
     if (size() != other.size())
         return false;
-    for (size_t i = 0; i < size(); ++i)
+    for (size_t i = 0; i < size(); ++i) {
         if (animation(i) != other.animation(i))
             return false;
+    }
     return true;
 }
 
index c84cb9b..ea7c9b7 100644 (file)
@@ -22,8 +22,7 @@
  *
  */
 
-#ifndef AnimationList_h
-#define AnimationList_h
+#pragma once
 
 #include "Animation.h"
 #include <wtf/RefPtr.h>
@@ -36,6 +35,7 @@ class AnimationList {
 public:
     AnimationList() { }
     AnimationList(const AnimationList&);
+    AnimationList(AnimationList&&) = default;
 
     void fillUnsetProperties();
     bool operator==(const AnimationList&) const;
@@ -49,22 +49,17 @@ public:
     
     void resize(size_t n) { m_animations.resize(n); }
     void remove(size_t i) { m_animations.remove(i); }
-    void append(PassRefPtr<Animation> animation)
-    {
-        ASSERT(animation);
-        m_animations.append(animation);
-    }
-    
-    Animation& animation(size_t i) { return *m_animations[i]; }
-    const Animation& animation(size_t i) const { return *m_animations[i]; }
+    void append(Ref<Animation>&& animation) { m_animations.append(WTFMove(animation)); }
+
+    Animation& animation(size_t i) { return m_animations[i].get(); }
+    const Animation& animation(size_t i) const { return m_animations[i].get(); }
     
 private:
     AnimationList& operator=(const AnimationList&);
+    AnimationList& operator=(AnimationList&&) = default;
 
-    Vector<RefPtr<Animation>> m_animations;
+    Vector<Ref<Animation>> m_animations;
 };    
 
 
 } // namespace WebCore
-
-#endif // AnimationList_h
index fca45c1..5ea01b2 100644 (file)
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef AnimationTrigger_h
-#define AnimationTrigger_h
+#pragma once
 
 #if ENABLE(CSS_ANIMATIONS_LEVEL_2)
 
 #include "Length.h"
+#include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
 #include <wtf/TypeCasts.h>
 
 namespace WebCore {
 
 class AnimationTrigger : public RefCounted<AnimationTrigger> {
 public:
-
-    virtual PassRefPtr<AnimationTrigger> clone() const = 0;
-
-    enum class AnimationTriggerType {
-        AutoAnimationTriggerType, ScrollAnimationTriggerType
-    };
+    virtual Ref<AnimationTrigger> clone() const = 0;
 
     virtual ~AnimationTrigger() { }
 
+    enum class AnimationTriggerType { AutoAnimationTriggerType, ScrollAnimationTriggerType };
     AnimationTriggerType type() const { return m_type; }
 
     bool isAutoAnimationTrigger() const { return m_type == AnimationTriggerType::AutoAnimationTriggerType; }
@@ -62,16 +57,14 @@ protected:
     AnimationTriggerType m_type;
 };
 
-class AutoAnimationTrigger : public AnimationTrigger {
+class AutoAnimationTrigger final : public AnimationTrigger {
 public:
-    static PassRefPtr<AutoAnimationTrigger> create()
+    static Ref<AutoAnimationTrigger> create()
     {
-        return adoptRef(new AutoAnimationTrigger);
+        return adoptRef(*new AutoAnimationTrigger);
     }
 
-    virtual ~AutoAnimationTrigger() { }
-
-    bool operator==(const AnimationTrigger& other) override
+    bool operator==(const AnimationTrigger& other) final
     {
         return other.isAutoAnimationTrigger();
     }
@@ -82,22 +75,20 @@ private:
     {
     }
 
-    PassRefPtr<AnimationTrigger> clone() const override
+    Ref<AnimationTrigger> clone() const final
     {
-        return adoptRef(new AutoAnimationTrigger);
+        return adoptRef(*new AutoAnimationTrigger);
     }
 };
 
-class ScrollAnimationTrigger : public AnimationTrigger {
+class ScrollAnimationTrigger final : public AnimationTrigger {
 public:
-    static PassRefPtr<ScrollAnimationTrigger> create(Length startValue, Length endValue)
+    static Ref<ScrollAnimationTrigger> create(Length startValue, Length endValue)
     {
-        return adoptRef(new ScrollAnimationTrigger(startValue, endValue));
+        return adoptRef(*new ScrollAnimationTrigger(startValue, endValue));
     }
 
-    virtual ~ScrollAnimationTrigger() { }
-
-    bool operator==(const AnimationTrigger& other) override
+    bool operator==(const AnimationTrigger& other) final
     {
         if (!other.isScrollAnimationTrigger())
             return false;
@@ -133,9 +124,9 @@ private:
             m_endValue = endValue;
     }
 
-    PassRefPtr<AnimationTrigger> clone() const override
+    Ref<AnimationTrigger> clone() const final
     {
-        return adoptRef(new ScrollAnimationTrigger(m_startValue, m_endValue));
+        return adoptRef(*new ScrollAnimationTrigger(m_startValue, m_endValue));
     }
 
     Length m_startValue;
@@ -154,5 +145,3 @@ SPECIALIZE_TYPE_TRAITS_ANIMATION_TRIGGER(AutoAnimationTrigger, isAutoAnimationTr
 SPECIALIZE_TYPE_TRAITS_ANIMATION_TRIGGER(ScrollAnimationTrigger, isScrollAnimationTrigger);
 
 #endif
-
-#endif // AnimationTrigger_h
index f5e6616..fcaa3c3 100644 (file)
  *
  */
 
-#ifndef TimingFunction_h
-#define TimingFunction_h
+#pragma once
 
-#include <wtf/PassRefPtr.h>
+#include <wtf/Ref.h>
 #include <wtf/RefCounted.h>
-#include <wtf/RefPtr.h>
 
 namespace WebCore {
 
+class TextStream;
+
 class TimingFunction : public RefCounted<TimingFunction> {
 public:
+    virtual Ref<TimingFunction> clone() const = 0;
 
-    virtual PassRefPtr<TimingFunction> clone() const = 0;
-
-    enum TimingFunctionType {
-        LinearFunction, CubicBezierFunction, StepsFunction, SpringFunction
-    };
-    
     virtual ~TimingFunction() { }
 
+    enum TimingFunctionType { LinearFunction, CubicBezierFunction, StepsFunction, SpringFunction };
     TimingFunctionType type() const { return m_type; }
-    
+
     bool isLinearTimingFunction() const { return m_type == LinearFunction; }
     bool isCubicBezierTimingFunction() const { return m_type == CubicBezierFunction; }
     bool isStepsTimingFunction() const { return m_type == StepsFunction; }
     bool isSpringTimingFunction() const { return m_type == SpringFunction; }
-    
-    virtual bool operator==(const TimingFunction& other) = 0;
+
+    virtual bool operator==(const TimingFunction&) const = 0;
+    bool operator!=(const TimingFunction& other) const { return !(*this == other); }
 
 protected:
-    TimingFunction(TimingFunctionType type)
+    explicit TimingFunction(TimingFunctionType type)
         : m_type(type)
     {
     }
-    
+
+private:
     TimingFunctionType m_type;
 };
 
 class LinearTimingFunction final : public TimingFunction {
 public:
-    static PassRefPtr<LinearTimingFunction> create()
+    static Ref<LinearTimingFunction> create()
     {
-        return adoptRef(new LinearTimingFunction);
+        return adoptRef(*new LinearTimingFunction);
     }
     
-    virtual ~LinearTimingFunction() { }
-    
-    bool operator==(const TimingFunction& other) override
+    bool operator==(const TimingFunction& other) const final
     {
         return other.isLinearTimingFunction();
     }
@@ -80,61 +76,54 @@ private:
     {
     }
 
-    PassRefPtr<TimingFunction> clone() const override
+    Ref<TimingFunction> clone() const final
     {
-        return adoptRef(new LinearTimingFunction);
+        return adoptRef(*new LinearTimingFunction);
     }
 };
 
 class CubicBezierTimingFunction final : public TimingFunction {
 public:
-    enum TimingFunctionPreset {
-        Ease,
-        EaseIn,
-        EaseOut,
-        EaseInOut,
-        Custom
-    };
+    enum TimingFunctionPreset { Ease, EaseIn, EaseOut, EaseInOut, Custom };
     
-    static PassRefPtr<CubicBezierTimingFunction> create(double x1, double y1, double x2, double y2)
+    static Ref<CubicBezierTimingFunction> create(double x1, double y1, double x2, double y2)
     {
-        return adoptRef(new CubicBezierTimingFunction(Custom, x1, y1, x2, y2));
+        return adoptRef(*new CubicBezierTimingFunction(Custom, x1, y1, x2, y2));
     }
 
-    static PassRefPtr<CubicBezierTimingFunction> create()
+    static Ref<CubicBezierTimingFunction> create()
     {
-        return adoptRef(new CubicBezierTimingFunction());
+        return adoptRef(*new CubicBezierTimingFunction());
     }
     
-    static PassRefPtr<CubicBezierTimingFunction> create(TimingFunctionPreset preset)
+    static Ref<CubicBezierTimingFunction> create(TimingFunctionPreset preset)
     {
         switch (preset) {
         case Ease:
-            return adoptRef(new CubicBezierTimingFunction());
+            return adoptRef(*new CubicBezierTimingFunction);
         case EaseIn:
-            return adoptRef(new CubicBezierTimingFunction(EaseIn, 0.42, 0.0, 1.0, 1.0));
+            return adoptRef(*new CubicBezierTimingFunction(EaseIn, 0.42, 0.0, 1.0, 1.0));
         case EaseOut:
-            return adoptRef(new CubicBezierTimingFunction(EaseOut, 0.0, 0.0, 0.58, 1.0));
+            return adoptRef(*new CubicBezierTimingFunction(EaseOut, 0.0, 0.0, 0.58, 1.0));
         case EaseInOut:
-            return adoptRef(new CubicBezierTimingFunction(EaseInOut, 0.42, 0.0, 0.58, 1.0));
-        default:
-            ASSERT_NOT_REACHED();
-            return 0;
+            return adoptRef(*new CubicBezierTimingFunction(EaseInOut, 0.42, 0.0, 0.58, 1.0));
+        case Custom:
+            break;
         }
+        ASSERT_NOT_REACHED();
+        return adoptRef(*new CubicBezierTimingFunction);
     }
 
-    virtual ~CubicBezierTimingFunction() { }
-    
-    bool operator==(const TimingFunction& other) override
+    bool operator==(const TimingFunction& other) const final
     {
-        if (other.isCubicBezierTimingFunction()) {
-            const CubicBezierTimingFunction* ctf = static_cast<const CubicBezierTimingFunction*>(&other);
-            if (m_timingFunctionPreset != Custom)
-                return m_timingFunctionPreset == ctf->m_timingFunctionPreset;
-            
-            return m_x1 == ctf->m_x1 && m_y1 == ctf->m_y1 && m_x2 == ctf->m_x2 && m_y2 == ctf->m_y2;
-        }
-        return false;
+        if (!other.isCubicBezierTimingFunction())
+            return false;
+        auto& otherCubic = static_cast<const CubicBezierTimingFunction&>(other);
+        if (m_timingFunctionPreset != otherCubic.m_timingFunctionPreset)
+            return false;
+        if (m_timingFunctionPreset != Custom)
+            return true;
+        return m_x1 == otherCubic.m_x1 && m_y1 == otherCubic.m_y1 && m_x2 == otherCubic.m_x2 && m_y2 == otherCubic.m_y2;
     }
 
     double x1() const { return m_x1; }
@@ -149,21 +138,21 @@ public:
         m_x2 = x2;
 &n