Diff
Modified: trunk/Source/WebCore/ChangeLog (201317 => 201318)
--- trunk/Source/WebCore/ChangeLog 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/ChangeLog 2016-05-24 05:34:49 UTC (rev 201318)
@@ -1,3 +1,86 @@
+2016-05-23 Alex Christensen <[email protected]>
+
+ Modernize CSS code
+ https://bugs.webkit.org/show_bug.cgi?id=157875
+
+ Reviewed by Chris Dumez.
+
+ * bindings/scripts/CodeGeneratorJS.pm:
+ (GenerateImplementation):
+ (GenerateParametersCheck):
+ * bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp:
+ (WebCore::jsTestMediaQueryListListenerPrototypeFunctionMethod):
+ * bindings/scripts/test/JS/JSTestObj.cpp:
+ (WebCore::JSTestObjConstructor::construct):
+ (WebCore::setJSTestObjPutForwardsNullableAttribute):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithCallbackFunctionArg):
+ (WebCore::jsTestObjPrototypeFunctionMethodWithNonCallbackArgAndCallbackFunctionArg):
+ (WebCore::jsTestObjConstructorFunctionStaticMethodWithCallbackArg):
+ (WebCore::jsTestObjPrototypeFunctionOverloadedMethod5):
+ * bindings/scripts/test/JS/JSTestTypedefs.cpp:
+ (WebCore::JSTestTypedefsConstructor::construct):
+ * css/CSSBasicShapes.cpp:
+ (WebCore::serializePositionOffset):
+ (WebCore::buildSerializablePositionOffset):
+ (WebCore::CSSBasicShapeCircle::cssText):
+ (WebCore::CSSBasicShapeEllipse::cssText):
+ * css/CSSCalculationValue.cpp:
+ (WebCore::determineCategory):
+ (WebCore::CSSCalcExpressionNodeParser::parseValue):
+ * css/CSSMediaRule.cpp:
+ (WebCore::CSSMediaRule::media):
+ * css/CSSMediaRule.h:
+ * css/CSSOMUtils.h:
+ * css/CSSParser.cpp:
+ (WebCore::CSSParser::createImportRule):
+ (WebCore::CSSParser::createMediaRule):
+ * css/CSSReflectValue.h:
+ * css/CSSStyleSheet.cpp:
+ (WebCore::CSSStyleSheet::setDisabled):
+ (WebCore::CSSStyleSheet::setMediaQueries):
+ (WebCore::CSSStyleSheet::insertRule):
+ (WebCore::CSSStyleSheet::deleteRule):
+ (WebCore::CSSStyleSheet::isLoading):
+ (WebCore::CSSStyleSheet::media):
+ (WebCore::CSSStyleSheet::parentStyleSheet):
+ (WebCore::CSSStyleSheet::ownerDocument):
+ (WebCore::CSSStyleSheet::clearChildRuleCSSOMWrappers):
+ (WebCore::CSSStyleSheet::RuleMutationScope::RuleMutationScope):
+ * css/CSSStyleSheet.h:
+ * css/PropertySetCSSStyleDeclaration.cpp:
+ * css/StyleRule.cpp:
+ (WebCore::StyleRuleBase::createCSSOMWrapper):
+ (WebCore::StyleRuleBase::destroy):
+ (WebCore::StyleRuleGroup::wrapperRemoveRule):
+ (WebCore::StyleRuleMedia::StyleRuleMedia):
+ * css/StyleRule.h:
+ (WebCore::StyleRuleBase::deref):
+ (WebCore::StyleRuleBase::StyleRuleBase):
+ (WebCore::StyleRuleMedia::create):
+ (WebCore::StyleRuleMedia::mediaQueries):
+ (WebCore::StyleRuleMedia::copy):
+ (isType):
+ * css/StyleRuleImport.cpp:
+ (WebCore::StyleRuleImport::create):
+ (WebCore::StyleRuleImport::StyleRuleImport):
+ * css/StyleRuleImport.h:
+ * css/StyleSheetContents.cpp:
+ (WebCore::StyleSheetContents::isCacheable):
+ (WebCore::StyleSheetContents::parserAppendRule):
+ (WebCore::StyleSheetContents::ruleAt):
+ (WebCore::StyleSheetContents::parserSetEncodingFromCharsetRule):
+ (WebCore::StyleSheetContents::wrapperInsertRule):
+ * css/StyleSheetContents.h:
+ (WebCore::StyleSheetContents::hasSyntacticallyValidCSSHeader):
+ (WebCore::StyleSheetContents::parserSetUsesRemUnits):
+ (WebCore::StyleSheetContents::parserSetUsesStyleBasedEditability):
+ (WebCore::StyleSheetContents::copy):
+ * dom/InlineStyleSheetOwner.cpp:
+ (WebCore::InlineStyleSheetOwner::createSheet):
+ * inspector/InspectorStyleSheet.cpp:
+
2016-05-23 Zalan Bujtas <[email protected]>
Changing border color and size simultaneously fails to repaint.
Modified: trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm (201317 => 201318)
--- trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm 2016-05-24 05:34:49 UTC (rev 201318)
@@ -2705,7 +2705,7 @@
my $jsType = NativeToJSValue($attribute->signature, 0, $interface, "${functionName}(" . join(", ", @arguments) . ")", "castedThis");
push(@implContent, " auto& impl = castedThis->wrapped();\n") if !$attribute->isStatic;
if ($codeGenerator->IsSVGAnimatedType($type)) {
- push(@implContent, " RefPtr<$type> obj = $jsType;\n");
+ push(@implContent, " auto obj = $jsType;\n");
push(@implContent, " JSValue result = toJS(state, castedThis->globalObject(), obj.get());\n");
} else {
push(@implContent, " JSValue result = $jsType;\n");
@@ -2918,7 +2918,7 @@
if ($putForwards) {
my $implGetterFunctionName = $codeGenerator->WK_lcfirst($attribute->signature->extendedAttributes->{"ImplementedAs"} || $name);
if ($attribute->signature->isNullable) {
- push(@implContent, " RefPtr<${type}> forwardedImpl = castedThis->wrapped().${implGetterFunctionName}();\n");
+ push(@implContent, " auto forwardedImpl = castedThis->wrapped().${implGetterFunctionName}();\n");
push(@implContent, " if (!forwardedImpl)\n");
push(@implContent, " return false;\n");
push(@implContent, " auto& impl = *forwardedImpl;\n");
@@ -3659,9 +3659,9 @@
push(@$outputArray, " return throwArgumentMustBeFunctionError(*state, $argumentIndex, \"$name\", \"$interfaceName\", $quotedFunctionName);\n");
if ($function->isStatic) {
AddToImplIncludes("CallbackFunction.h");
- push(@$outputArray, " RefPtr<$type> $name = createFunctionOnlyCallback<${callbackClassName}>(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), state->uncheckedArgument($argumentIndex));\n");
+ push(@$outputArray, " auto $name = createFunctionOnlyCallback<${callbackClassName}>(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), state->uncheckedArgument($argumentIndex));\n");
} else {
- push(@$outputArray, " RefPtr<$type> $name = ${callbackClassName}::create(asObject(state->uncheckedArgument($argumentIndex)), castedThis->globalObject());\n");
+ push(@$outputArray, " auto $name = ${callbackClassName}::create(asObject(state->uncheckedArgument($argumentIndex)), castedThis->globalObject());\n");
}
}
$value = "WTFMove($name)";
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp (201317 => 201318)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestMediaQueryListListener.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -160,7 +160,7 @@
return throwVMError(state, createNotEnoughArgumentsError(state));
if (UNLIKELY(!state->argument(0).isFunction()))
return throwArgumentMustBeFunctionError(*state, 0, "listener", "TestMediaQueryListListener", "method");
- RefPtr<MediaQueryListListener> listener = JSMediaQueryListListener::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());
+ auto listener = JSMediaQueryListListener::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());
impl.method(WTFMove(listener));
return JSValue::encode(jsUndefined());
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp (201317 => 201318)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -1015,10 +1015,10 @@
return throwVMError(state, createNotEnoughArgumentsError(state));
if (UNLIKELY(!state->argument(0).isObject()))
return throwArgumentMustBeFunctionError(*state, 0, "testCallback", "TestObj", nullptr);
- RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());
+ auto testCallback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());
if (UNLIKELY(!state->argument(1).isFunction()))
return throwArgumentMustBeFunctionError(*state, 1, "testCallbackFunction", "TestObj", nullptr);
- RefPtr<TestCallbackFunction> testCallbackFunction = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());
+ auto testCallbackFunction = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());
auto object = TestObj::create(*testCallback, *testCallbackFunction);
return JSValue::encode(asObject(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))));
}
@@ -3852,7 +3852,7 @@
if (UNLIKELY(!castedThis)) {
return throwSetterTypeError(*state, "TestObj", "putForwardsNullableAttribute");
}
- RefPtr<TestNode> forwardedImpl = castedThis->wrapped().putForwardsNullableAttribute();
+ auto forwardedImpl = castedThis->wrapped().putForwardsNullableAttribute();
if (!forwardedImpl)
return false;
auto& impl = *forwardedImpl;
@@ -5021,7 +5021,7 @@
return throwVMError(state, createNotEnoughArgumentsError(state));
if (UNLIKELY(!state->argument(0).isObject()))
return throwArgumentMustBeFunctionError(*state, 0, "callback", "TestObj", "methodWithCallbackArg");
- RefPtr<TestCallback> callback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());
+ auto callback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());
impl.methodWithCallbackArg(WTFMove(callback));
return JSValue::encode(jsUndefined());
}
@@ -5041,7 +5041,7 @@
return JSValue::encode(jsUndefined());
if (UNLIKELY(!state->argument(1).isObject()))
return throwArgumentMustBeFunctionError(*state, 1, "callback", "TestObj", "methodWithNonCallbackArgAndCallbackArg");
- RefPtr<TestCallback> callback = JSTestCallback::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());
+ auto callback = JSTestCallback::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());
impl.methodWithNonCallbackArgAndCallbackArg(WTFMove(nonCallback), WTFMove(callback));
return JSValue::encode(jsUndefined());
}
@@ -5076,7 +5076,7 @@
return throwVMError(state, createNotEnoughArgumentsError(state));
if (UNLIKELY(!state->argument(0).isFunction()))
return throwArgumentMustBeFunctionError(*state, 0, "callback", "TestObj", "methodWithCallbackFunctionArg");
- RefPtr<TestCallbackFunction> callback = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());
+ auto callback = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());
impl.methodWithCallbackFunctionArg(WTFMove(callback));
return JSValue::encode(jsUndefined());
}
@@ -5096,7 +5096,7 @@
return JSValue::encode(jsUndefined());
if (UNLIKELY(!state->argument(1).isFunction()))
return throwArgumentMustBeFunctionError(*state, 1, "callback", "TestObj", "methodWithNonCallbackArgAndCallbackFunctionArg");
- RefPtr<TestCallbackFunction> callback = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());
+ auto callback = JSTestCallbackFunction::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());
impl.methodWithNonCallbackArgAndCallbackFunctionArg(WTFMove(nonCallback), WTFMove(callback));
return JSValue::encode(jsUndefined());
}
@@ -5137,7 +5137,7 @@
return throwVMError(state, createNotEnoughArgumentsError(state));
if (UNLIKELY(!state->argument(0).isObject()))
return throwArgumentMustBeFunctionError(*state, 0, "callback", "TestObj", "staticMethodWithCallbackArg");
- RefPtr<TestCallback> callback = createFunctionOnlyCallback<JSTestCallback>(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), state->uncheckedArgument(0));
+ auto callback = createFunctionOnlyCallback<JSTestCallback>(state, jsCast<JSDOMGlobalObject*>(state->lexicalGlobalObject()), state->uncheckedArgument(0));
TestObj::staticMethodWithCallbackArg(WTFMove(callback));
return JSValue::encode(jsUndefined());
}
@@ -5269,7 +5269,7 @@
return throwVMError(state, createNotEnoughArgumentsError(state));
if (UNLIKELY(!state->argument(0).isObject()))
return throwArgumentMustBeFunctionError(*state, 0, "callback", "TestObj", "overloadedMethod");
- RefPtr<TestCallback> callback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());
+ auto callback = JSTestCallback::create(asObject(state->uncheckedArgument(0)), castedThis->globalObject());
impl.overloadedMethod(WTFMove(callback));
return JSValue::encode(jsUndefined());
}
Modified: trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp (201317 => 201318)
--- trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/bindings/scripts/test/JS/JSTestTypedefs.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -134,7 +134,7 @@
return JSValue::encode(jsUndefined());
if (UNLIKELY(!state->argument(1).isObject()))
return throwArgumentMustBeFunctionError(*state, 1, "testCallback", "TestTypedefs", nullptr);
- RefPtr<TestCallback> testCallback = JSTestCallback::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());
+ auto testCallback = JSTestCallback::create(asObject(state->uncheckedArgument(1)), castedThis->globalObject());
auto object = TestTypedefs::create(hello, *testCallback);
return JSValue::encode(asObject(toJSNewlyCreated(state, castedThis->globalObject(), WTFMove(object))));
}
Modified: trunk/Source/WebCore/css/CSSBasicShapes.cpp (201317 => 201318)
--- trunk/Source/WebCore/css/CSSBasicShapes.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/CSSBasicShapes.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -51,7 +51,7 @@
return offset.cssText();
}
-static Ref<CSSPrimitiveValue> buildSerializablePositionOffset(PassRefPtr<CSSPrimitiveValue> offset, CSSValueID defaultSide)
+static Ref<CSSPrimitiveValue> buildSerializablePositionOffset(CSSPrimitiveValue* offset, CSSValueID defaultSide)
{
CSSValueID side = defaultSide;
RefPtr<CSSPrimitiveValue> amount;
@@ -110,8 +110,8 @@
String CSSBasicShapeCircle::cssText() const
{
- Ref<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX, CSSValueLeft);
- Ref<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
+ Ref<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX.get(), CSSValueLeft);
+ Ref<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY.get(), CSSValueTop);
String radius;
if (m_radius && m_radius->getValueID() != CSSValueClosestSide)
@@ -167,8 +167,8 @@
String CSSBasicShapeEllipse::cssText() const
{
- Ref<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX, CSSValueLeft);
- Ref<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY, CSSValueTop);
+ Ref<CSSPrimitiveValue> normalizedCX = buildSerializablePositionOffset(m_centerX.get(), CSSValueLeft);
+ Ref<CSSPrimitiveValue> normalizedCY = buildSerializablePositionOffset(m_centerY.get(), CSSValueTop);
String radiusX;
String radiusY;
Modified: trunk/Source/WebCore/css/CSSCalculationValue.cpp (201317 => 201318)
--- trunk/Source/WebCore/css/CSSCalculationValue.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/CSSCalculationValue.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -200,9 +200,9 @@
class CSSCalcPrimitiveValue final : public CSSCalcExpressionNode {
WTF_MAKE_FAST_ALLOCATED;
public:
- static Ref<CSSCalcPrimitiveValue> create(PassRefPtr<CSSPrimitiveValue> value, bool isInteger)
+ static Ref<CSSCalcPrimitiveValue> create(Ref<CSSPrimitiveValue>&& value, bool isInteger)
{
- return adoptRef(*new CSSCalcPrimitiveValue(value, isInteger));
+ return adoptRef(*new CSSCalcPrimitiveValue(WTFMove(value), isInteger));
}
static RefPtr<CSSCalcPrimitiveValue> create(double value, CSSPrimitiveValue::UnitTypes type, bool isInteger)
@@ -232,9 +232,7 @@
return std::make_unique<CalcExpressionLength>(Length(m_value->computeLength<float>(conversionData), WebCore::Fixed));
case CalcPercent:
case CalcPercentLength: {
- CSSPrimitiveValue* primitiveValue = m_value.get();
- return std::make_unique<CalcExpressionLength>(primitiveValue
- ? primitiveValue->convertToLength<FixedFloatConversion | PercentConversion>(conversionData) : Length(Undefined));
+ return std::make_unique<CalcExpressionLength>(m_value->convertToLength<FixedFloatConversion | PercentConversion>(conversionData));
}
// Only types that could be part of a Length _expression_ can be converted
// to a CalcExpressionNode. CalcPercentNumber makes no sense as a Length.
@@ -283,7 +281,7 @@
if (type() != other.type())
return false;
- return compareCSSValuePtr(m_value, static_cast<const CSSCalcPrimitiveValue&>(other).m_value);
+ return compareCSSValue(m_value, static_cast<const CSSCalcPrimitiveValue&>(other).m_value);
}
Type type() const override { return CssCalcPrimitiveValue; }
@@ -293,13 +291,13 @@
}
private:
- explicit CSSCalcPrimitiveValue(PassRefPtr<CSSPrimitiveValue> value, bool isInteger)
+ explicit CSSCalcPrimitiveValue(Ref<CSSPrimitiveValue>&& value, bool isInteger)
: CSSCalcExpressionNode(unitCategory((CSSPrimitiveValue::UnitTypes)value->primitiveType()), isInteger)
- , m_value(value)
+ , m_value(WTFMove(value))
{
}
- RefPtr<CSSPrimitiveValue> m_value;
+ Ref<CSSPrimitiveValue> m_value;
};
static const CalculationCategory addSubtractResult[CalcAngle][CalcAngle] = {
@@ -610,8 +608,7 @@
if (!is<CSSPrimitiveValue>(value.get()))
return false;
- CSSPrimitiveValue& primitiveValue = downcast<CSSPrimitiveValue>(*value);
- result->value = CSSCalcPrimitiveValue::create(&primitiveValue, parserValue->isInt);
+ result->value = CSSCalcPrimitiveValue::create(Ref<CSSPrimitiveValue>(downcast<CSSPrimitiveValue>(*value)), parserValue->isInt);
++*index;
return true;
Modified: trunk/Source/WebCore/css/CSSMediaRule.cpp (201317 => 201318)
--- trunk/Source/WebCore/css/CSSMediaRule.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/CSSMediaRule.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -27,6 +27,7 @@
#include "CSSRuleList.h"
#include "CSSStyleSheet.h"
#include "ExceptionCode.h"
+#include "MediaList.h"
#include "StyleRule.h"
#include <wtf/text/StringBuilder.h>
@@ -65,7 +66,7 @@
MediaList* CSSMediaRule::media() const
{
if (!mediaQueries())
- return 0;
+ return nullptr;
if (!m_mediaCSSOMWrapper)
m_mediaCSSOMWrapper = MediaList::create(mediaQueries(), const_cast<CSSMediaRule*>(this));
return m_mediaCSSOMWrapper.get();
Modified: trunk/Source/WebCore/css/CSSMediaRule.h (201317 => 201318)
--- trunk/Source/WebCore/css/CSSMediaRule.h 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/CSSMediaRule.h 2016-05-24 05:34:49 UTC (rev 201318)
@@ -20,14 +20,13 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef CSSMediaRule_h
-#define CSSMediaRule_h
+#pragma once
#include "CSSGroupingRule.h"
-#include "MediaList.h"
namespace WebCore {
+class MediaList;
class StyleRuleMedia;
class CSSMediaRule final : public CSSGroupingRule {
@@ -54,5 +53,3 @@
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_CSS_RULE(CSSMediaRule, CSSRule::MEDIA_RULE)
-
-#endif // CSSMediaRule_h
Modified: trunk/Source/WebCore/css/CSSOMUtils.h (201317 => 201318)
--- trunk/Source/WebCore/css/CSSOMUtils.h 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/CSSOMUtils.h 2016-05-24 05:34:49 UTC (rev 201318)
@@ -28,12 +28,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CSSOMUtils_h
-#define CSSOMUtils_h
+#pragma once
-#include <unicode/utypes.h>
+#include <unicode/umachine.h>
#include <wtf/Forward.h>
-#include <wtf/Vector.h>
// Utilities for CSSOM http://dev.w3.org/csswg/cssom/
@@ -46,5 +44,3 @@
void serializeString(const String&, StringBuilder&);
} // namespace WebCore
-
-#endif // CSSOMUtils_h
Modified: trunk/Source/WebCore/css/CSSParser.cpp (201317 => 201318)
--- trunk/Source/WebCore/css/CSSParser.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/CSSParser.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -12805,7 +12805,7 @@
popRuleData();
return nullptr;
}
- auto rule = StyleRuleImport::create(url, media);
+ auto rule = StyleRuleImport::create(url, media.releaseNonNull());
processAndAddNewRuleToSourceTreeIfNeeded();
return WTFMove(rule);
}
@@ -12820,7 +12820,7 @@
// even when it is syntactically incorrect.
rule = StyleRuleMedia::create(MediaQuerySet::create(), emptyRules);
} else
- rule = StyleRuleMedia::create(media, rules ? *rules : emptyRules);
+ rule = StyleRuleMedia::create(media.releaseNonNull(), rules ? *rules : emptyRules);
processAndAddNewRuleToSourceTreeIfNeeded();
return rule.releaseNonNull();
}
Modified: trunk/Source/WebCore/css/CSSReflectValue.h (201317 => 201318)
--- trunk/Source/WebCore/css/CSSReflectValue.h 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/CSSReflectValue.h 2016-05-24 05:34:49 UTC (rev 201318)
@@ -23,12 +23,10 @@
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
-#ifndef CSSReflectValue_h
-#define CSSReflectValue_h
+#pragma once
#include "CSSReflectionDirection.h"
#include "CSSValue.h"
-#include <wtf/PassRefPtr.h>
#include <wtf/RefPtr.h>
namespace WebCore {
@@ -71,5 +69,3 @@
} // namespace WebCore
SPECIALIZE_TYPE_TRAITS_CSS_VALUE(CSSReflectValue, isReflectValue())
-
-#endif // CSSReflectValue_h
Modified: trunk/Source/WebCore/css/CSSStyleSheet.cpp (201317 => 201318)
--- trunk/Source/WebCore/css/CSSStyleSheet.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/CSSStyleSheet.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -222,9 +222,9 @@
didMutate();
}
-void CSSStyleSheet::setMediaQueries(PassRefPtr<MediaQuerySet> mediaQueries)
+void CSSStyleSheet::setMediaQueries(Ref<MediaQuerySet>&& mediaQueries)
{
- m_mediaQueries = mediaQueries;
+ m_mediaQueries = WTFMove(mediaQueries);
if (m_mediaCSSOMWrapper && m_mediaQueries)
m_mediaCSSOMWrapper->reattach(m_mediaQueries.get());
@@ -310,7 +310,7 @@
RuleMutationScope mutationScope(this, RuleInsertion, is<StyleRuleKeyframes>(*rule) ? downcast<StyleRuleKeyframes>(rule.get()) : nullptr);
- bool success = m_contents.get().wrapperInsertRule(rule, index);
+ bool success = m_contents.get().wrapperInsertRule(rule.releaseNonNull(), index);
if (!success) {
ec = HIERARCHY_REQUEST_ERR;
return 0;
@@ -336,7 +336,7 @@
if (!m_childRuleCSSOMWrappers.isEmpty()) {
if (m_childRuleCSSOMWrappers[index])
- m_childRuleCSSOMWrappers[index]->setParentStyleSheet(0);
+ m_childRuleCSSOMWrappers[index]->setParentStyleSheet(nullptr);
m_childRuleCSSOMWrappers.remove(index);
}
}
@@ -381,9 +381,9 @@
}
MediaList* CSSStyleSheet::media() const
-{
+{
if (!m_mediaQueries)
- return 0;
+ return nullptr;
if (!m_mediaCSSOMWrapper)
m_mediaCSSOMWrapper = MediaList::create(m_mediaQueries.get(), const_cast<CSSStyleSheet*>(this));
@@ -392,7 +392,7 @@
CSSStyleSheet* CSSStyleSheet::parentStyleSheet() const
{
- return m_ownerRule ? m_ownerRule->parentStyleSheet() : 0;
+ return m_ownerRule ? m_ownerRule->parentStyleSheet() : nullptr;
}
Document* CSSStyleSheet::ownerDocument() const
@@ -400,7 +400,7 @@
const CSSStyleSheet* root = this;
while (root->parentStyleSheet())
root = root->parentStyleSheet();
- return root->ownerNode() ? &root->ownerNode()->document() : 0;
+ return root->ownerNode() ? &root->ownerNode()->document() : nullptr;
}
void CSSStyleSheet::clearChildRuleCSSOMWrappers()
@@ -418,7 +418,7 @@
}
CSSStyleSheet::RuleMutationScope::RuleMutationScope(CSSRule* rule)
- : m_styleSheet(rule ? rule->parentStyleSheet() : 0)
+ : m_styleSheet(rule ? rule->parentStyleSheet() : nullptr)
, m_mutationType(OtherMutation)
, m_contentsWereClonedForMutation(ContentsWereNotClonedForMutation)
, m_insertedKeyframesRule(nullptr)
Modified: trunk/Source/WebCore/css/CSSStyleSheet.h (201317 => 201318)
--- trunk/Source/WebCore/css/CSSStyleSheet.h 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/CSSStyleSheet.h 2016-05-24 05:34:49 UTC (rev 201318)
@@ -22,7 +22,6 @@
#define CSSStyleSheet_h
#include "CSSParserMode.h"
-#include "CSSRule.h"
#include "StyleSheet.h"
#include <memory>
#include <wtf/HashMap.h>
@@ -85,7 +84,7 @@
void clearOwnerRule() { m_ownerRule = 0; }
Document* ownerDocument() const;
MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
- void setMediaQueries(PassRefPtr<MediaQuerySet>);
+ void setMediaQueries(Ref<MediaQuerySet>&&);
void setTitle(const String& title) { m_title = title; }
bool hadRulesMutation() const { return m_mutatedRules; }
Modified: trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp (201317 => 201318)
--- trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/PropertySetCSSStyleDeclaration.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -24,6 +24,7 @@
#include "CSSCustomPropertyValue.h"
#include "CSSParser.h"
+#include "CSSRule.h"
#include "CSSStyleSheet.h"
#include "HTMLNames.h"
#include "InspectorInstrumentation.h"
Modified: trunk/Source/WebCore/css/StyleRule.cpp (201317 => 201318)
--- trunk/Source/WebCore/css/StyleRule.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/StyleRule.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -32,6 +32,7 @@
#include "CSSStyleRule.h"
#include "CSSSupportsRule.h"
#include "CSSUnknownRule.h"
+#include "MediaList.h"
#include "StyleProperties.h"
#include "StyleRuleImport.h"
#include "WebKitCSSRegionRule.h"
@@ -45,14 +46,14 @@
COMPILE_ASSERT(sizeof(StyleRuleBase) == sizeof(SameSizeAsStyleRuleBase), StyleRuleBase_should_stay_small);
-PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet) const
+RefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSStyleSheet* parentSheet) const
{
- return createCSSOMWrapper(parentSheet, 0);
+ return createCSSOMWrapper(parentSheet, nullptr);
}
-PassRefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSRule* parentRule) const
+RefPtr<CSSRule> StyleRuleBase::createCSSOMWrapper(CSSRule* parentRule) const
{
- return createCSSOMWrapper(0, parentRule);
+ return createCSSOMWrapper(nullptr, parentRule);
}
void StyleRuleBase::destroy()
@@ -329,9 +330,9 @@
}
-StyleRuleMedia::StyleRuleMedia(PassRefPtr<MediaQuerySet> media, Vector<RefPtr<StyleRuleBase>>& adoptRules)
+StyleRuleMedia::StyleRuleMedia(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>& adoptRules)
: StyleRuleGroup(Media, adoptRules)
- , m_mediaQueries(media)
+ , m_mediaQueries(WTFMove(media))
{
}
Modified: trunk/Source/WebCore/css/StyleRule.h (201317 => 201318)
--- trunk/Source/WebCore/css/StyleRule.h 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/StyleRule.h 2016-05-24 05:34:49 UTC (rev 201318)
@@ -19,11 +19,9 @@
* Boston, MA 02110-1301, USA.
*/
-#ifndef StyleRule_h
-#define StyleRule_h
+#pragma once
#include "CSSSelectorList.h"
-#include "MediaList.h"
#include "StyleProperties.h"
#include <wtf/RefPtr.h>
#include <wtf/TypeCasts.h>
@@ -33,6 +31,7 @@
class CSSRule;
class CSSStyleRule;
class CSSStyleSheet;
+class MediaQuerySet;
class MutableStyleProperties;
class StyleProperties;
@@ -82,8 +81,8 @@
}
// FIXME: There shouldn't be any need for the null parent version.
- PassRefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet = 0) const;
- PassRefPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) const;
+ RefPtr<CSSRule> createCSSOMWrapper(CSSStyleSheet* parentSheet = nullptr) const;
+ RefPtr<CSSRule> createCSSOMWrapper(CSSRule* parentRule) const;
protected:
StyleRuleBase(Type type, signed sourceLine = 0) : m_type(type), m_sourceLine(sourceLine) { }
@@ -193,9 +192,9 @@
class StyleRuleMedia : public StyleRuleGroup {
public:
- static Ref<StyleRuleMedia> create(PassRefPtr<MediaQuerySet> media, Vector<RefPtr<StyleRuleBase>>& adoptRules)
+ static Ref<StyleRuleMedia> create(Ref<MediaQuerySet>&& media, Vector<RefPtr<StyleRuleBase>>& adoptRules)
{
- return adoptRef(*new StyleRuleMedia(media, adoptRules));
+ return adoptRef(*new StyleRuleMedia(WTFMove(media), adoptRules));
}
MediaQuerySet* mediaQueries() const { return m_mediaQueries.get(); }
@@ -203,7 +202,7 @@
Ref<StyleRuleMedia> copy() const { return adoptRef(*new StyleRuleMedia(*this)); }
private:
- StyleRuleMedia(PassRefPtr<MediaQuerySet>, Vector<RefPtr<StyleRuleBase>>& adoptRules);
+ StyleRuleMedia(Ref<MediaQuerySet>&&, Vector<RefPtr<StyleRuleBase>>& adoptRules);
StyleRuleMedia(const StyleRuleMedia&);
RefPtr<MediaQuerySet> m_mediaQueries;
@@ -297,5 +296,3 @@
static bool isType(const WebCore::StyleRuleBase& rule) { return rule.isViewportRule(); }
SPECIALIZE_TYPE_TRAITS_END()
#endif // ENABLE(CSS_DEVICE_ADAPTATION)
-
-#endif // StyleRule_h
Modified: trunk/Source/WebCore/css/StyleRuleImport.cpp (201317 => 201318)
--- trunk/Source/WebCore/css/StyleRuleImport.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/StyleRuleImport.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -28,23 +28,24 @@
#include "CachedResourceRequest.h"
#include "CachedResourceRequestInitiators.h"
#include "Document.h"
+#include "MediaList.h"
#include "SecurityOrigin.h"
#include "StyleSheetContents.h"
#include <wtf/StdLibExtras.h>
namespace WebCore {
-Ref<StyleRuleImport> StyleRuleImport::create(const String& href, PassRefPtr<MediaQuerySet> media)
+Ref<StyleRuleImport> StyleRuleImport::create(const String& href, Ref<MediaQuerySet>&& media)
{
- return adoptRef(*new StyleRuleImport(href, media));
+ return adoptRef(*new StyleRuleImport(href, WTFMove(media)));
}
-StyleRuleImport::StyleRuleImport(const String& href, PassRefPtr<MediaQuerySet> media)
+StyleRuleImport::StyleRuleImport(const String& href, Ref<MediaQuerySet>&& media)
: StyleRuleBase(Import, 0)
, m_parentStyleSheet(0)
, m_styleSheetClient(this)
, m_strHref(href)
- , m_mediaQueries(media)
+ , m_mediaQueries(WTFMove(media))
, m_cachedSheet(0)
, m_loading(false)
{
Modified: trunk/Source/WebCore/css/StyleRuleImport.h (201317 => 201318)
--- trunk/Source/WebCore/css/StyleRuleImport.h 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/StyleRuleImport.h 2016-05-24 05:34:49 UTC (rev 201318)
@@ -36,7 +36,7 @@
class StyleRuleImport : public StyleRuleBase {
WTF_MAKE_FAST_ALLOCATED;
public:
- static Ref<StyleRuleImport> create(const String& href, PassRefPtr<MediaQuerySet>);
+ static Ref<StyleRuleImport> create(const String& href, Ref<MediaQuerySet>&&);
~StyleRuleImport();
@@ -70,7 +70,7 @@
void setCSSStyleSheet(const String& href, const URL& baseURL, const String& charset, const CachedCSSStyleSheet*);
friend class ImportedStyleSheetClient;
- StyleRuleImport(const String& href, PassRefPtr<MediaQuerySet>);
+ StyleRuleImport(const String& href, Ref<MediaQuerySet>&&);
StyleSheetContents* m_parentStyleSheet;
Modified: trunk/Source/WebCore/css/StyleSheetContents.cpp (201317 => 201318)
--- trunk/Source/WebCore/css/StyleSheetContents.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/StyleSheetContents.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -129,13 +129,13 @@
return true;
}
-void StyleSheetContents::parserAppendRule(PassRefPtr<StyleRuleBase> rule)
+void StyleSheetContents::parserAppendRule(Ref<StyleRuleBase>&& rule)
{
ASSERT(!rule->isCharsetRule());
- if (is<StyleRuleImport>(*rule)) {
+ if (is<StyleRuleImport>(rule)) {
// Parser enforces that @import rules come before anything else except @charset.
ASSERT(m_childRules.isEmpty());
- m_importRules.append(downcast<StyleRuleImport>(rule.get()));
+ m_importRules.append(downcast<StyleRuleImport>(rule.ptr()));
m_importRules.last()->setParentStyleSheet(this);
m_importRules.last()->requestStyleSheet();
return;
@@ -143,19 +143,19 @@
#if ENABLE(RESOLUTION_MEDIA_QUERY)
// Add warning message to inspector if dpi/dpcm values are used for screen media.
- if (is<StyleRuleMedia>(*rule))
- reportMediaQueryWarningIfNeeded(singleOwnerDocument(), downcast<StyleRuleMedia>(*rule).mediaQueries());
+ if (is<StyleRuleMedia>(rule))
+ reportMediaQueryWarningIfNeeded(singleOwnerDocument(), downcast<StyleRuleMedia>(rule.get()).mediaQueries());
#endif
// NOTE: The selector list has to fit into RuleData. <http://webkit.org/b/118369>
// If we're adding a rule with a huge number of selectors, split it up into multiple rules
- if (is<StyleRule>(*rule) && downcast<StyleRule>(*rule).selectorList().componentCount() > RuleData::maximumSelectorComponentCount) {
- Vector<RefPtr<StyleRule>> rules = downcast<StyleRule>(*rule).splitIntoMultipleRulesWithMaximumSelectorComponentCount(RuleData::maximumSelectorComponentCount);
+ if (is<StyleRule>(rule) && downcast<StyleRule>(rule.get()).selectorList().componentCount() > RuleData::maximumSelectorComponentCount) {
+ Vector<RefPtr<StyleRule>> rules = downcast<StyleRule>(rule.get()).splitIntoMultipleRulesWithMaximumSelectorComponentCount(RuleData::maximumSelectorComponentCount);
m_childRules.appendVector(rules);
return;
}
- m_childRules.append(rule);
+ m_childRules.append(WTFMove(rule));
}
StyleRuleBase* StyleSheetContents::ruleAt(unsigned index) const
@@ -207,7 +207,7 @@
m_encodingFromCharsetRule = encoding;
}
-bool StyleSheetContents::wrapperInsertRule(PassRefPtr<StyleRuleBase> rule, unsigned index)
+bool StyleSheetContents::wrapperInsertRule(Ref<StyleRuleBase>&& rule, unsigned index)
{
ASSERT(m_isMutable);
ASSERT_WITH_SECURITY_IMPLICATION(index <= ruleCount());
@@ -226,24 +226,24 @@
if (childVectorIndex < m_importRules.size() || (childVectorIndex == m_importRules.size() && rule->isImportRule())) {
// Inserting non-import rule before @import is not allowed.
- if (!is<StyleRuleImport>(*rule))
+ if (!is<StyleRuleImport>(rule))
return false;
- m_importRules.insert(childVectorIndex, downcast<StyleRuleImport>(rule.get()));
+ m_importRules.insert(childVectorIndex, downcast<StyleRuleImport>(rule.ptr()));
m_importRules[childVectorIndex]->setParentStyleSheet(this);
m_importRules[childVectorIndex]->requestStyleSheet();
// FIXME: Stylesheet doesn't actually change meaningfully before the imported sheets are loaded.
return true;
}
// Inserting @import rule after a non-import rule is not allowed.
- if (is<StyleRuleImport>(*rule))
+ if (is<StyleRuleImport>(rule))
return false;
childVectorIndex -= m_importRules.size();
// If the number of selectors would overflow RuleData, we drop the operation.
- if (is<StyleRule>(*rule) && downcast<StyleRule>(*rule).selectorList().componentCount() > RuleData::maximumSelectorComponentCount)
+ if (is<StyleRule>(rule) && downcast<StyleRule>(rule.get()).selectorList().componentCount() > RuleData::maximumSelectorComponentCount)
return false;
- m_childRules.insert(childVectorIndex, rule);
+ m_childRules.insert(childVectorIndex, WTFMove(rule));
return true;
}
Modified: trunk/Source/WebCore/css/StyleSheetContents.h (201317 => 201318)
--- trunk/Source/WebCore/css/StyleSheetContents.h 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/css/StyleSheetContents.h 2016-05-24 05:34:49 UTC (rev 201318)
@@ -94,7 +94,7 @@
bool hasSyntacticallyValidCSSHeader() const { return m_hasSyntacticallyValidCSSHeader; }
void parserAddNamespace(const AtomicString& prefix, const AtomicString& uri);
- void parserAppendRule(PassRefPtr<StyleRuleBase>);
+ void parserAppendRule(Ref<StyleRuleBase>&&);
void parserSetEncodingFromCharsetRule(const String& encoding);
void parserSetUsesRemUnits() { m_usesRemUnits = true; }
void parserSetUsesStyleBasedEditability() { m_usesStyleBasedEditability = true; }
@@ -127,7 +127,7 @@
unsigned estimatedSizeInBytes() const;
- bool wrapperInsertRule(PassRefPtr<StyleRuleBase>, unsigned index);
+ bool wrapperInsertRule(Ref<StyleRuleBase>&&, unsigned index);
void wrapperDeleteRule(unsigned index);
Ref<StyleSheetContents> copy() const { return adoptRef(*new StyleSheetContents(*this)); }
Modified: trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp (201317 => 201318)
--- trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/dom/InlineStyleSheetOwner.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -158,7 +158,7 @@
m_loading = true;
m_sheet = CSSStyleSheet::createInline(element, URL(), m_startTextPosition, document.encoding());
- m_sheet->setMediaQueries(mediaQueries.release());
+ m_sheet->setMediaQueries(mediaQueries.releaseNonNull());
m_sheet->setTitle(element.title());
m_sheet->contents().parseStringAtPosition(text, m_startTextPosition, m_isParsingChildren);
Modified: trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp (201317 => 201318)
--- trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp 2016-05-24 05:19:00 UTC (rev 201317)
+++ trunk/Source/WebCore/inspector/InspectorStyleSheet.cpp 2016-05-24 05:34:49 UTC (rev 201318)
@@ -45,6 +45,7 @@
#include "HTMLStyleElement.h"
#include "InspectorCSSAgent.h"
#include "InspectorPageAgent.h"
+#include "MediaList.h"
#include "Node.h"
#include "SVGElement.h"
#include "SVGNames.h"