Changeset 201318 in webkit
- Timestamp:
- May 23, 2016 10:34:49 PM (8 years ago)
- Location:
- trunk/Source/WebCore
- Files:
-
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r201312 r201318 1 2016-05-23 Alex Christensen <achristensen@webkit.org> 2 3 Modernize CSS code 4 https://bugs.webkit.org/show_bug.cgi?id=157875 5 6 Reviewed by Chris Dumez. 7 8 * bindings/scripts/CodeGeneratorJS.pm: 9 (GenerateImplementation): 10 (GenerateParametersCheck): 11 * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp: 12 (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod): 13 * bindings/scripts/test/JS/JSTestObj.cpp: 14 (WebCore::JSTestObjConstructor::construct): 15 (WebCore::setJSTestObjPutForwardsNullableAttribute): 16 (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg): 17 (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg): 18 (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionArg): 19 (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg): 20 (WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackArg): 21 (WebCore::jsTestObjPrototypeFunctionOverloadedMethod5): 22 * bindings/scripts/test/JS/JSTestTypedefs.cpp: 23 (WebCore::JSTestTypedefsConstructor::construct): 24 * css/CSSBasicShapes.cpp: 25 (WebCore::serializePositionOffset): 26 (WebCore::buildSerializablePositionOffset): 27 (WebCore::CSSBasicShapeCircle::cssText): 28 (WebCore::CSSBasicShapeEllipse::cssText): 29 * css/CSSCalculationValue.cpp: 30 (WebCore::determineCategory): 31 (WebCore::CSSCalcExpressionNodeParser::parseValue): 32 * css/CSSMediaRule.cpp: 33 (WebCore::CSSMediaRule::media): 34 * css/CSSMediaRule.h: 35 * css/CSSOMUtils.h: 36 * css/CSSParser.cpp: 37 (WebCore::CSSParser::createImportRule): 38 (WebCore::CSSParser::createMediaRule): 39 * css/CSSReflectValue.h: 40 * css/CSSStyleSheet.cpp: 41 (WebCore::CSSStyleSheet::setDisabled): 42 (WebCore::CSSStyleSheet::setMediaQueries): 43 (WebCore::CSSStyleSheet::insertRule): 44 (WebCore::CSSStyleSheet::deleteRule): 45 (WebCore::CSSStyleSheet::isLoading): 46 (WebCore::CSSStyleSheet::media): 47 (WebCore::CSSStyleSheet::parentStyleSheet): 48 (WebCore::CSSStyleSheet::ownerDocument): 49 (WebCore::CSSStyleSheet::clearChildRuleCSSOMWrappers): 50 (WebCore::CSSStyleSheet::RuleMutationScope::RuleMutationScope): 51 * css/CSSStyleSheet.h: 52 * css/PropertySetCSSStyleDeclaration.cpp: 53 * css/StyleRule.cpp: 54 (WebCore::StyleRuleBase::createCSSOMWrapper): 55 (WebCore::StyleRuleBase::destroy): 56 (WebCore::StyleRuleGroup::wrapperRemoveRule): 57 (WebCore::StyleRuleMedia::StyleRuleMedia): 58 * css/StyleRule.h: 59 (WebCore::StyleRuleBase::deref): 60 (WebCore::StyleRuleBase::StyleRuleBase): 61 (WebCore::StyleRuleMedia::create): 62 (WebCore::StyleRuleMedia::mediaQueries): 63 (WebCore::StyleRuleMedia::copy): 64 (isType): 65 * css/StyleRuleImport.cpp: 66 (WebCore::StyleRuleImport::create): 67 (WebCore::StyleRuleImport::StyleRuleImport): 68 * css/StyleRuleImport.h: 69 * css/StyleSheetContents.cpp: 70 (WebCore::StyleSheetContents::isCacheable): 71 (WebCore::StyleSheetContents::parserAppendRule): 72 (WebCore::StyleSheetContents::ruleAt): 73 (WebCore::StyleSheetContents::parserSetEncodingFromCharsetRule): 74 (WebCore::StyleSheetContents::wrapperInsertRule): 75 * css/StyleSheetContents.h: 76 (WebCore::StyleSheetContents::hasSyntacticallyValidCSSHeader): 77 (WebCore::StyleSheetContents::parserSetUsesRemUnits): 78 (WebCore::StyleSheetContents::parserSetUsesStyleBasedEditability): 79 (WebCore::StyleSheetContents::copy): 80 * dom/InlineStyleSheetOwner.cpp: 81 (WebCore::InlineStyleSheetOwner::createSheet): 82 * inspector/InspectorStyleSheet.cpp: 83 1 84 2016-05-23 Zalan Bujtas <zalan@apple.com> 2 85 -
trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
r201305 r201318 2706 2706 push(@implContent, " auto& impl = castedThis->wrapped();\n") if !$attribute->isStatic; 2707 2707 if ($codeGenerator->IsSVGAnimatedType($type)) { 2708 push(@implContent, " RefPtr<$type>obj = $jsType;\n");2708 push(@implContent, " auto obj = $jsType;\n"); 2709 2709 push(@implContent, " JSValue result = toJS(state, castedThis->globalObject(), obj.get());\n"); 2710 2710 } else { … … 2919 2919 my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->signature->extendedAttributes->{"ImplementedAs"} || $name); 2920 2920 if ($attribute->signature->isNullable) { 2921 push(@implContent, " RefPtr<${type}>forwardedImpl = castedThis->wrapped().${implGetterFunctionName}();\n");2921 push(@implContent, " auto forwardedImpl = castedThis->wrapped().${implGetterFunctionName}();\n"); 2922 2922 push(@implContent, " if (!forwardedImpl)\n"); 2923 2923 push(@implContent, " return false;\n"); … … 3660 3660 if ($function->isStatic) { 3661 3661 AddToImplIncludes("CallbackFunction.h"); 3662 push(@$outputArray, " RefPtr<$type>$name = createFunctionOnlyCallback<${callbackClassName}>(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), state->uncheckedArgument($argumentIndex));\n");3662 push(@$outputArray, " auto $name = createFunctionOnlyCallback<${callbackClassName}>(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), state->uncheckedArgument($argumentIndex));\n"); 3663 3663 } else { 3664 push(@$outputArray, " RefPtr<$type>$name = ${callbackClassName}::create(asObject(state->uncheckedArgument($argumentIndex)), castedThis->globalObject());\n");3664 push(@$outputArray, " auto $name = ${callbackClassName}::create(asObject(state->uncheckedArgument($argumentIndex)), castedThis->globalObject());\n"); 3665 3665 } 3666 3666 } -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp
r201166 r201318 161 161 if (UNLIKELY(!state->argument(0).isFunction())) 162 162 return throwArgumentMustBeFunctionError(*state, 0, "listener", "TestMediaQueryListListener", "method"); 163 RefPtr<MediaQueryListListener>listener = JSMediaQueryListListener::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());163 auto listener = JSMediaQueryListListener::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject()); 164 164 impl.method(WTFMove(listener)); 165 165 return JSValue::encode(jsUndefined()); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
r201305 r201318 1016 1016 if (UNLIKELY(!state->argument(0).isObject())) 1017 1017 return throwArgumentMustBeFunctionError(*state, 0, "testCallback", "TestObj", nullptr); 1018 RefPtr<TestCallback>testCallback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());1018 auto testCallback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject()); 1019 1019 if (UNLIKELY(!state->argument(1).isFunction())) 1020 1020 return throwArgumentMustBeFunctionError(*state, 1, "testCallbackFunction", "TestObj", nullptr); 1021 RefPtr<TestCallbackFunction>testCallbackFunction = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());1021 auto testCallbackFunction = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject()); 1022 1022 auto object = TestObj::create(*testCallback, *testCallbackFunction); 1023 1023 return JSValue::encode(asObject(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)))); … … 3853 3853 return throwSetterTypeError(*state, "TestObj", "putForwardsNullableAttribute"); 3854 3854 } 3855 RefPtr<TestNode>forwardedImpl = castedThis->wrapped().putForwardsNullableAttribute();3855 auto forwardedImpl = castedThis->wrapped().putForwardsNullableAttribute(); 3856 3856 if (!forwardedImpl) 3857 3857 return false; … … 5022 5022 if (UNLIKELY(!state->argument(0).isObject())) 5023 5023 return throwArgumentMustBeFunctionError(*state, 0, "callback", "TestObj", "methodWithCallbackArg"); 5024 RefPtr<TestCallback>callback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());5024 auto callback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject()); 5025 5025 impl.methodWithCallbackArg(WTFMove(callback)); 5026 5026 return JSValue::encode(jsUndefined()); … … 5042 5042 if (UNLIKELY(!state->argument(1).isObject())) 5043 5043 return throwArgumentMustBeFunctionError(*state, 1, "callback", "TestObj", "methodWithNonCallbackArgAndCallbackArg"); 5044 RefPtr<TestCallback>callback = JSTestCallback::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());5044 auto callback = JSTestCallback::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject()); 5045 5045 impl.methodWithNonCallbackArgAndCallbackArg(WTFMove(nonCallback), WTFMove(callback)); 5046 5046 return JSValue::encode(jsUndefined()); … … 5077 5077 if (UNLIKELY(!state->argument(0).isFunction())) 5078 5078 return throwArgumentMustBeFunctionError(*state, 0, "callback", "TestObj", "methodWithCallbackFunctionArg"); 5079 RefPtr<TestCallbackFunction>callback = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());5079 auto callback = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject()); 5080 5080 impl.methodWithCallbackFunctionArg(WTFMove(callback)); 5081 5081 return JSValue::encode(jsUndefined()); … … 5097 5097 if (UNLIKELY(!state->argument(1).isFunction())) 5098 5098 return throwArgumentMustBeFunctionError(*state, 1, "callback", "TestObj", "methodWithNonCallbackArgAndCallbackFunctionArg"); 5099 RefPtr<TestCallbackFunction>callback = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());5099 auto callback = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject()); 5100 5100 impl.methodWithNonCallbackArgAndCallbackFunctionArg(WTFMove(nonCallback), WTFMove(callback)); 5101 5101 return JSValue::encode(jsUndefined()); … … 5138 5138 if (UNLIKELY(!state->argument(0).isObject())) 5139 5139 return throwArgumentMustBeFunctionError(*state, 0, "callback", "TestObj", "staticMethodWithCallbackArg"); 5140 RefPtr<TestCallback>callback = createFunctionOnlyCallback<JSTestCallback>(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), state->uncheckedArgument(0));5140 auto callback = createFunctionOnlyCallback<JSTestCallback>(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), state->uncheckedArgument(0)); 5141 5141 TestObj::staticMethodWithCallbackArg(WTFMove(callback)); 5142 5142 return JSValue::encode(jsUndefined()); … … 5270 5270 if (UNLIKELY(!state->argument(0).isObject())) 5271 5271 return throwArgumentMustBeFunctionError(*state, 0, "callback", "TestObj", "overloadedMethod"); 5272 RefPtr<TestCallback>callback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());5272 auto callback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject()); 5273 5273 impl.overloadedMethod(WTFMove(callback)); 5274 5274 return JSValue::encode(jsUndefined()); -
trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp
r201166 r201318 135 135 if (UNLIKELY(!state->argument(1).isObject())) 136 136 return throwArgumentMustBeFunctionError(*state, 1, "testCallback", "TestTypedefs", nullptr); 137 RefPtr<TestCallback>testCallback = JSTestCallback::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());137 auto testCallback = JSTestCallback::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject()); 138 138 auto object = TestTypedefs::create(hello, *testCallback); 139 139 return JSValue::encode(asObject(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object)))); -
trunk/Source/WebCore/css/CSSBasicShapes.cpp
r201290 r201318 52 52 } 53 53 54 static Ref<CSSPrimitiveValue> buildSerializablePositionOffset( PassRefPtr<CSSPrimitiveValue>offset, CSSValueID defaultSide)54 static Ref<CSSPrimitiveValue> buildSerializablePositionOffset(CSSPrimitiveValue* offset, CSSValueID defaultSide) 55 55 { 56 56 CSSValueID side = defaultSide; … … 111 111 String CSSBasicShapeCircle::cssText() const 112 112 { 113 Ref<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX , CSSValueLeft);114 Ref<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY , CSSValueTop);113 Ref<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX.get(), CSSValueLeft); 114 Ref<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY.get(), CSSValueTop); 115 115 116 116 String radius; … … 168 168 String CSSBasicShapeEllipse::cssText() const 169 169 { 170 Ref<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX , CSSValueLeft);171 Ref<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY , CSSValueTop);170 Ref<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX.get(), CSSValueLeft); 171 Ref<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY.get(), CSSValueTop); 172 172 173 173 String radiusX; -
trunk/Source/WebCore/css/CSSCalculationValue.cpp
r200977 r201318 201 201 WTF_MAKE_FAST_ALLOCATED; 202 202 public: 203 static Ref<CSSCalcPrimitiveValue> create( PassRefPtr<CSSPrimitiveValue>value, bool isInteger)204 { 205 return adoptRef(*new CSSCalcPrimitiveValue( value, isInteger));203 static Ref<CSSCalcPrimitiveValue> create(Ref<CSSPrimitiveValue>&& value, bool isInteger) 204 { 205 return adoptRef(*new CSSCalcPrimitiveValue(WTFMove(value), isInteger)); 206 206 } 207 207 … … 233 233 case CalcPercent: 234 234 case CalcPercentLength: { 235 CSSPrimitiveValue* primitiveValue = m_value.get(); 236 return std::make_unique<CalcExpressionLength>(primitiveValue 237 ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion>(conversionData) : Length(Undefined)); 235 return std::make_unique<CalcExpressionLength>(m_value->convertToLength<FixedFloatConversion | PercentConversion>(conversionData)); 238 236 } 239 237 // Only types that could be part of a Length expression can be converted … … 284 282 return false; 285 283 286 return compareCSSValue Ptr(m_value, static_cast<const CSSCalcPrimitiveValue&>(other).m_value);284 return compareCSSValue(m_value, static_cast<const CSSCalcPrimitiveValue&>(other).m_value); 287 285 } 288 286 … … 294 292 295 293 private: 296 explicit CSSCalcPrimitiveValue( PassRefPtr<CSSPrimitiveValue>value, bool isInteger)294 explicit CSSCalcPrimitiveValue(Ref<CSSPrimitiveValue>&& value, bool isInteger) 297 295 : CSSCalcExpressionNode(unitCategory((CSSPrimitiveValue::UnitTypes)value->primitiveType()), isInteger) 298 , m_value( value)299 { 300 } 301 302 Ref Ptr<CSSPrimitiveValue> m_value;296 , m_value(WTFMove(value)) 297 { 298 } 299 300 Ref<CSSPrimitiveValue> m_value; 303 301 }; 304 302 … … 611 609 return false; 612 610 613 CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value); 614 result->value = CSSCalcPrimitiveValue::create(&primitiveValue, parserValue->isInt); 611 result->value = CSSCalcPrimitiveValue::create(Ref<CSSPrimitiveValue>(downcast<CSSPrimitiveValue>(*value)), parserValue->isInt); 615 612 616 613 ++*index; -
trunk/Source/WebCore/css/CSSMediaRule.cpp
r175548 r201318 28 28 #include "CSSStyleSheet.h" 29 29 #include "ExceptionCode.h" 30 #include "MediaList.h" 30 31 #include "StyleRule.h" 31 32 #include <wtf/text/StringBuilder.h> … … 66 67 { 67 68 if (!mediaQueries()) 68 return 0;69 return nullptr; 69 70 if (!m_mediaCSSOMWrapper) 70 71 m_mediaCSSOMWrapper = MediaList::create(mediaQueries(), const_cast<CSSMediaRule*>(this)); -
trunk/Source/WebCore/css/CSSMediaRule.h
r197563 r201318 21 21 */ 22 22 23 #ifndef CSSMediaRule_h 24 #define CSSMediaRule_h 23 #pragma once 25 24 26 25 #include "CSSGroupingRule.h" 27 #include "MediaList.h"28 26 29 27 namespace WebCore { 30 28 29 class MediaList; 31 30 class StyleRuleMedia; 32 31 … … 55 54 56 55 SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSMediaRule, CSSRule::MEDIA_RULE) 57 58 #endif // CSSMediaRule_h -
trunk/Source/WebCore/css/CSSOMUtils.h
r166044 r201318 29 29 */ 30 30 31 #ifndef CSSOMUtils_h 32 #define CSSOMUtils_h 31 #pragma once 33 32 34 #include <unicode/u types.h>33 #include <unicode/umachine.h> 35 34 #include <wtf/Forward.h> 36 #include <wtf/Vector.h>37 35 38 36 // Utilities for CSSOM http://dev.w3.org/csswg/cssom/ … … 47 45 48 46 } // namespace WebCore 49 50 #endif // CSSOMUtils_h -
trunk/Source/WebCore/css/CSSParser.cpp
r201290 r201318 12806 12806 return nullptr; 12807 12807 } 12808 auto rule = StyleRuleImport::create(url, media );12808 auto rule = StyleRuleImport::create(url, media.releaseNonNull()); 12809 12809 processAndAddNewRuleToSourceTreeIfNeeded(); 12810 12810 return WTFMove(rule); … … 12821 12821 rule = StyleRuleMedia::create(MediaQuerySet::create(), emptyRules); 12822 12822 } else 12823 rule = StyleRuleMedia::create(media , rules ? *rules : emptyRules);12823 rule = StyleRuleMedia::create(media.releaseNonNull(), rules ? *rules : emptyRules); 12824 12824 processAndAddNewRuleToSourceTreeIfNeeded(); 12825 12825 return rule.releaseNonNull(); -
trunk/Source/WebCore/css/CSSReflectValue.h
r201290 r201318 24 24 */ 25 25 26 #ifndef CSSReflectValue_h 27 #define CSSReflectValue_h 26 #pragma once 28 27 29 28 #include "CSSReflectionDirection.h" 30 29 #include "CSSValue.h" 31 #include <wtf/PassRefPtr.h>32 30 #include <wtf/RefPtr.h> 33 31 … … 72 70 73 71 SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSReflectValue, isReflectValue()) 74 75 #endif // CSSReflectValue_h -
trunk/Source/WebCore/css/CSSStyleSheet.cpp
r201290 r201318 223 223 } 224 224 225 void CSSStyleSheet::setMediaQueries( PassRefPtr<MediaQuerySet>mediaQueries)226 { 227 m_mediaQueries = mediaQueries;225 void CSSStyleSheet::setMediaQueries(Ref<MediaQuerySet>&& mediaQueries) 226 { 227 m_mediaQueries = WTFMove(mediaQueries); 228 228 if (m_mediaCSSOMWrapper && m_mediaQueries) 229 229 m_mediaCSSOMWrapper->reattach(m_mediaQueries.get()); … … 311 311 RuleMutationScope mutationScope(this, RuleInsertion, is<StyleRuleKeyframes>(*rule) ? downcast<StyleRuleKeyframes>(rule.get()) : nullptr); 312 312 313 bool success = m_contents.get().wrapperInsertRule(rule , index);313 bool success = m_contents.get().wrapperInsertRule(rule.releaseNonNull(), index); 314 314 if (!success) { 315 315 ec = HIERARCHY_REQUEST_ERR; … … 337 337 if (!m_childRuleCSSOMWrappers.isEmpty()) { 338 338 if (m_childRuleCSSOMWrappers[index]) 339 m_childRuleCSSOMWrappers[index]->setParentStyleSheet( 0);339 m_childRuleCSSOMWrappers[index]->setParentStyleSheet(nullptr); 340 340 m_childRuleCSSOMWrappers.remove(index); 341 341 } … … 382 382 383 383 MediaList* CSSStyleSheet::media() const 384 { 384 { 385 385 if (!m_mediaQueries) 386 return 0;386 return nullptr; 387 387 388 388 if (!m_mediaCSSOMWrapper) … … 393 393 CSSStyleSheet* CSSStyleSheet::parentStyleSheet() const 394 394 { 395 return m_ownerRule ? m_ownerRule->parentStyleSheet() : 0;395 return m_ownerRule ? m_ownerRule->parentStyleSheet() : nullptr; 396 396 } 397 397 … … 401 401 while (root->parentStyleSheet()) 402 402 root = root->parentStyleSheet(); 403 return root->ownerNode() ? &root->ownerNode()->document() : 0;403 return root->ownerNode() ? &root->ownerNode()->document() : nullptr; 404 404 } 405 405 … … 419 419 420 420 CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSRule* rule) 421 : m_styleSheet(rule ? rule->parentStyleSheet() : 0)421 : m_styleSheet(rule ? rule->parentStyleSheet() : nullptr) 422 422 , m_mutationType(OtherMutation) 423 423 , m_contentsWereClonedForMutation(ContentsWereNotClonedForMutation) -
trunk/Source/WebCore/css/CSSStyleSheet.h
r200110 r201318 23 23 24 24 #include "CSSParserMode.h" 25 #include "CSSRule.h"26 25 #include "StyleSheet.h" 27 26 #include <memory> … … 86 85 Document* ownerDocument() const; 87 86 MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); } 88 void setMediaQueries( PassRefPtr<MediaQuerySet>);87 void setMediaQueries(Ref<MediaQuerySet>&&); 89 88 void setTitle(const String& title) { m_title = title; } 90 89 -
trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp
r200769 r201318 25 25 #include "CSSCustomPropertyValue.h" 26 26 #include "CSSParser.h" 27 #include "CSSRule.h" 27 28 #include "CSSStyleSheet.h" 28 29 #include "HTMLNames.h" -
trunk/Source/WebCore/css/StyleRule.cpp
r200626 r201318 33 33 #include "CSSSupportsRule.h" 34 34 #include "CSSUnknownRule.h" 35 #include "MediaList.h" 35 36 #include "StyleProperties.h" 36 37 #include "StyleRuleImport.h" … … 46 47 COMPILE_ASSERT(sizeof(StyleRuleBase) == sizeof(SameSizeAsStyleRuleBase), StyleRuleBase_should_stay_small); 47 48 48 PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet) const49 { 50 return createCSSOMWrapper(parentSheet, 0);51 } 52 53 PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSRule* parentRule) const49 RefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet) const 50 { 51 return createCSSOMWrapper(parentSheet, nullptr); 52 } 53 54 RefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSRule* parentRule) const 54 55 { 55 return createCSSOMWrapper( 0, parentRule);56 return createCSSOMWrapper(nullptr, parentRule); 56 57 } 57 58 … … 330 331 331 332 332 StyleRuleMedia::StyleRuleMedia( PassRefPtr<MediaQuerySet>media, Vector<RefPtr<StyleRuleBase>>& adoptRules)333 StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>& adoptRules) 333 334 : StyleRuleGroup(Media, adoptRules) 334 , m_mediaQueries( media)335 , m_mediaQueries(WTFMove(media)) 335 336 { 336 337 } -
trunk/Source/WebCore/css/StyleRule.h
r200626 r201318 20 20 */ 21 21 22 #ifndef StyleRule_h 23 #define StyleRule_h 22 #pragma once 24 23 25 24 #include "CSSSelectorList.h" 26 #include "MediaList.h"27 25 #include "StyleProperties.h" 28 26 #include <wtf/RefPtr.h> … … 34 32 class CSSStyleRule; 35 33 class CSSStyleSheet; 34 class MediaQuerySet; 36 35 class MutableStyleProperties; 37 36 class StyleProperties; … … 83 82 84 83 // FIXME: There shouldn't be any need for the null parent version. 85 PassRefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet = 0) const;86 PassRefPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) const;84 RefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet = nullptr) const; 85 RefPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) const; 87 86 88 87 protected: … … 194 193 class StyleRuleMedia : public StyleRuleGroup { 195 194 public: 196 static Ref<StyleRuleMedia> create( PassRefPtr<MediaQuerySet>media, Vector<RefPtr<StyleRuleBase>>& adoptRules)197 { 198 return adoptRef(*new StyleRuleMedia( media, adoptRules));195 static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>& adoptRules) 196 { 197 return adoptRef(*new StyleRuleMedia(WTFMove(media), adoptRules)); 199 198 } 200 199 … … 204 203 205 204 private: 206 StyleRuleMedia( PassRefPtr<MediaQuerySet>, Vector<RefPtr<StyleRuleBase>>& adoptRules);205 StyleRuleMedia(Ref<MediaQuerySet>&&, Vector<RefPtr<StyleRuleBase>>& adoptRules); 207 206 StyleRuleMedia(const StyleRuleMedia&); 208 207 … … 298 297 SPECIALIZE_TYPE_TRAITS_END() 299 298 #endif // ENABLE(CSS_DEVICE_ADAPTATION) 300 301 #endif // StyleRule_h -
trunk/Source/WebCore/css/StyleRuleImport.cpp
r187489 r201318 29 29 #include "CachedResourceRequestInitiators.h" 30 30 #include "Document.h" 31 #include "MediaList.h" 31 32 #include "SecurityOrigin.h" 32 33 #include "StyleSheetContents.h" … … 35 36 namespace WebCore { 36 37 37 Ref<StyleRuleImport> StyleRuleImport::create(const String& href, PassRefPtr<MediaQuerySet>media)38 Ref<StyleRuleImport> StyleRuleImport::create(const String& href, Ref<MediaQuerySet>&& media) 38 39 { 39 return adoptRef(*new StyleRuleImport(href, media));40 return adoptRef(*new StyleRuleImport(href, WTFMove(media))); 40 41 } 41 42 42 StyleRuleImport::StyleRuleImport(const String& href, PassRefPtr<MediaQuerySet>media)43 StyleRuleImport::StyleRuleImport(const String& href, Ref<MediaQuerySet>&& media) 43 44 : StyleRuleBase(Import, 0) 44 45 , m_parentStyleSheet(0) 45 46 , m_styleSheetClient(this) 46 47 , m_strHref(href) 47 , m_mediaQueries( media)48 , m_mediaQueries(WTFMove(media)) 48 49 , m_cachedSheet(0) 49 50 , m_loading(false) -
trunk/Source/WebCore/css/StyleRuleImport.h
r177259 r201318 37 37 WTF_MAKE_FAST_ALLOCATED; 38 38 public: 39 static Ref<StyleRuleImport> create(const String& href, PassRefPtr<MediaQuerySet>);39 static Ref<StyleRuleImport> create(const String& href, Ref<MediaQuerySet>&&); 40 40 41 41 ~StyleRuleImport(); … … 71 71 friend class ImportedStyleSheetClient; 72 72 73 StyleRuleImport(const String& href, PassRefPtr<MediaQuerySet>);73 StyleRuleImport(const String& href, Ref<MediaQuerySet>&&); 74 74 75 75 StyleSheetContents* m_parentStyleSheet; -
trunk/Source/WebCore/css/StyleSheetContents.cpp
r200895 r201318 130 130 } 131 131 132 void StyleSheetContents::parserAppendRule( PassRefPtr<StyleRuleBase>rule)132 void StyleSheetContents::parserAppendRule(Ref<StyleRuleBase>&& rule) 133 133 { 134 134 ASSERT(!rule->isCharsetRule()); 135 if (is<StyleRuleImport>( *rule)) {135 if (is<StyleRuleImport>(rule)) { 136 136 // Parser enforces that @import rules come before anything else except @charset. 137 137 ASSERT(m_childRules.isEmpty()); 138 m_importRules.append(downcast<StyleRuleImport>(rule. get()));138 m_importRules.append(downcast<StyleRuleImport>(rule.ptr())); 139 139 m_importRules.last()->setParentStyleSheet(this); 140 140 m_importRules.last()->requestStyleSheet(); … … 144 144 #if ENABLE(RESOLUTION_MEDIA_QUERY) 145 145 // Add warning message to inspector if dpi/dpcm values are used for screen media. 146 if (is<StyleRuleMedia>( *rule))147 reportMediaQueryWarningIfNeeded(singleOwnerDocument(), downcast<StyleRuleMedia>( *rule).mediaQueries());146 if (is<StyleRuleMedia>(rule)) 147 reportMediaQueryWarningIfNeeded(singleOwnerDocument(), downcast<StyleRuleMedia>(rule.get()).mediaQueries()); 148 148 #endif 149 149 150 150 // NOTE: The selector list has to fit into RuleData. <http://webkit.org/b/118369> 151 151 // If we're adding a rule with a huge number of selectors, split it up into multiple rules 152 if (is<StyleRule>( *rule) && downcast<StyleRule>(*rule).selectorList().componentCount() > RuleData::maximumSelectorComponentCount) {153 Vector<RefPtr<StyleRule>> rules = downcast<StyleRule>( *rule).splitIntoMultipleRulesWithMaximumSelectorComponentCount(RuleData::maximumSelectorComponentCount);152 if (is<StyleRule>(rule) && downcast<StyleRule>(rule.get()).selectorList().componentCount() > RuleData::maximumSelectorComponentCount) { 153 Vector<RefPtr<StyleRule>> rules = downcast<StyleRule>(rule.get()).splitIntoMultipleRulesWithMaximumSelectorComponentCount(RuleData::maximumSelectorComponentCount); 154 154 m_childRules.appendVector(rules); 155 155 return; 156 156 } 157 157 158 m_childRules.append( rule);158 m_childRules.append(WTFMove(rule)); 159 159 } 160 160 … … 208 208 } 209 209 210 bool StyleSheetContents::wrapperInsertRule( PassRefPtr<StyleRuleBase>rule, unsigned index)210 bool StyleSheetContents::wrapperInsertRule(Ref<StyleRuleBase>&& rule, unsigned index) 211 211 { 212 212 ASSERT(m_isMutable); … … 227 227 if (childVectorIndex < m_importRules.size() || (childVectorIndex == m_importRules.size() && rule->isImportRule())) { 228 228 // Inserting non-import rule before @import is not allowed. 229 if (!is<StyleRuleImport>( *rule))229 if (!is<StyleRuleImport>(rule)) 230 230 return false; 231 m_importRules.insert(childVectorIndex, downcast<StyleRuleImport>(rule. get()));231 m_importRules.insert(childVectorIndex, downcast<StyleRuleImport>(rule.ptr())); 232 232 m_importRules[childVectorIndex]->setParentStyleSheet(this); 233 233 m_importRules[childVectorIndex]->requestStyleSheet(); … … 236 236 } 237 237 // Inserting @import rule after a non-import rule is not allowed. 238 if (is<StyleRuleImport>( *rule))238 if (is<StyleRuleImport>(rule)) 239 239 return false; 240 240 childVectorIndex -= m_importRules.size(); 241 241 242 242 // If the number of selectors would overflow RuleData, we drop the operation. 243 if (is<StyleRule>( *rule) && downcast<StyleRule>(*rule).selectorList().componentCount() > RuleData::maximumSelectorComponentCount)244 return false; 245 246 m_childRules.insert(childVectorIndex, rule);243 if (is<StyleRule>(rule) && downcast<StyleRule>(rule.get()).selectorList().componentCount() > RuleData::maximumSelectorComponentCount) 244 return false; 245 246 m_childRules.insert(childVectorIndex, WTFMove(rule)); 247 247 return true; 248 248 } -
trunk/Source/WebCore/css/StyleSheetContents.h
r195304 r201318 95 95 96 96 void parserAddNamespace(const AtomicString& prefix, const AtomicString& uri); 97 void parserAppendRule( PassRefPtr<StyleRuleBase>);97 void parserAppendRule(Ref<StyleRuleBase>&&); 98 98 void parserSetEncodingFromCharsetRule(const String& encoding); 99 99 void parserSetUsesRemUnits() { m_usesRemUnits = true; } … … 128 128 unsigned estimatedSizeInBytes() const; 129 129 130 bool wrapperInsertRule( PassRefPtr<StyleRuleBase>, unsigned index);130 bool wrapperInsertRule(Ref<StyleRuleBase>&&, unsigned index); 131 131 void wrapperDeleteRule(unsigned index); 132 132 -
trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp
r197944 r201318 159 159 160 160 m_sheet = CSSStyleSheet::createInline(element, URL(), m_startTextPosition, document.encoding()); 161 m_sheet->setMediaQueries(mediaQueries.release ());161 m_sheet->setMediaQueries(mediaQueries.releaseNonNull()); 162 162 m_sheet->setTitle(element.title()); 163 163 m_sheet->contents().parseStringAtPosition(text, m_startTextPosition, m_isParsingChildren); -
trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp
r201290 r201318 46 46 #include "InspectorCSSAgent.h" 47 47 #include "InspectorPageAgent.h" 48 #include "MediaList.h" 48 49 #include "Node.h" 49 50 #include "SVGElement.h"
Note: See TracChangeset
for help on using the changeset viewer.