Source/WebCore/ChangeLog

 12016-04-06 Sam Weinig <sam@webkit.org>
 2
 3 window.CSS should be a constructor with static functions
 4 https://bugs.webkit.org/show_bug.cgi?id=156294
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 Rename DOMWindowCSS to DOMCSSNamespace to avoid name collisions, DOMWindow prefixed
 9 classes cause collisions in JSDOMWindow.
 10
 11 * CMakeLists.txt:
 12 * DerivedSources.make:
 13 * WebCore.xcodeproj/project.pbxproj:
 14 Update for renames.
 15
 16 * css/DOMCSSNamespace.cpp: Copied from Source/WebCore/css/DOMWindowCSS.cpp.
 17 (WebCore::valueWithoutImportant):
 18 (WebCore::DOMCSSNamespace::supports):
 19 (WebCore::DOMWindowCSS::create): Deleted.
 20 (WebCore::DOMWindowCSS::supports): Deleted.
 21 * css/DOMCSSNamespace.h: Copied from Source/WebCore/css/DOMWindowCSS.h.
 22 (WebCore::DOMWindowCSS::DOMWindowCSS): Deleted.
 23 Rename DOMWindowCSS to DOMCSSNamespace and turn functions into static functions.
 24
 25 * css/DOMCSSNamespace.idl: Copied from Source/WebCore/css/DOMWindowCSS.idl.
 26 Remove NoInterfaceObject, to inject a constructor, and turn functions into
 27 static functions matching spec.
 28
 29 * page/DOMWindow.cpp:
 30 (WebCore::DOMWindow::css): Deleted.
 31 * page/DOMWindow.h:
 32 * page/DOMWindow.idl:
 33 Remove CSS property. Constructor will be implicitly added.
 34
1352016-04-06 Jer Noble <jer.noble@apple.com>
236
337 CRASH in -[WebCoreNSURLSession taskCompleted:]
199108

Source/WebCore/CMakeLists.txt

@@set(WebCore_NON_SVG_IDL_FILES
334334 css/CSSValue.idl
335335 css/CSSValueList.idl
336336 css/Counter.idl
337  css/DOMWindowCSS.idl
 337 css/DOMCSSNamespace.idl
338338 css/FontFace.idl
339339 css/FontFaceSet.idl
340340 css/MediaList.idl

@@set(WebCore_SOURCES
13401340 css/CSSValuePool.cpp
13411341 css/CSSVariableDependentValue.cpp
13421342 css/CSSVariableValue.cpp
1343  css/DOMWindowCSS.cpp
 1343 css/DOMCSSNamespace.cpp
13441344 css/DocumentRuleSets.cpp
13451345 css/ElementRuleCollector.cpp
13461346 css/FontVariantBuilder.cpp
199108

Source/WebCore/DerivedSources.make

@@NON_SVG_BINDING_IDLS = \
247247 $(WebCore)/css/CSSValue.idl \
248248 $(WebCore)/css/CSSValueList.idl \
249249 $(WebCore)/css/Counter.idl \
250  $(WebCore)/css/DOMWindowCSS.idl \
 250 $(WebCore)/css/DOMCSSNamespace.idl \
251251 $(WebCore)/css/FontFace.idl \
252252 $(WebCore)/css/FontFaceSet.idl \
253253 $(WebCore)/css/MediaList.idl \
199108

Source/WebCore/PlatformGTK.cmake

@@list(APPEND GObjectDOMBindingsUnstable_I
545545
546546 Modules/webdatabase/Database.idl
547547
548  css/DOMWindowCSS.idl
 548 css/DOMCSSNamespace.idl
549549 css/MediaQueryList.idl
550550 css/StyleMedia.idl
551551
199108

Source/WebCore/WebCore.xcodeproj/project.pbxproj

68466846 FBF89045169E9F1F0052D86E /* CSSGroupingRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FBF89044169E9F1F0052D86E /* CSSGroupingRule.cpp */; };
68476847 FC54D05716A7673100575E4D /* CSSSupportsRule.h in Headers */ = {isa = PBXBuildFile; fileRef = FC63BDB1167AABAC00F9380F /* CSSSupportsRule.h */; };
68486848 FC54D05816A7676E00575E4D /* JSCSSSupportsRule.h in Headers */ = {isa = PBXBuildFile; fileRef = FC84802E167AB444008CD100 /* JSCSSSupportsRule.h */; };
6849  FC9A0F75164094CF003D6B8D /* DOMWindowCSS.h in Headers */ = {isa = PBXBuildFile; fileRef = FC9A0F72164094CF003D6B8D /* DOMWindowCSS.h */; };
6850  FC9E0E4D16419C1E00392BE3 /* JSDOMWindowCSS.h in Headers */ = {isa = PBXBuildFile; fileRef = FC9E0E4B16419C1E00392BE3 /* JSDOMWindowCSS.h */; };
 6849 FC9A0F75164094CF003D6B8D /* DOMCSSNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = FC9A0F72164094CF003D6B8D /* DOMCSSNamespace.h */; };
 6850 FC9E0E4D16419C1E00392BE3 /* JSDOMCSSNamespace.h in Headers */ = {isa = PBXBuildFile; fileRef = FC9E0E4B16419C1E00392BE3 /* JSDOMCSSNamespace.h */; };
68516851 FCD8832A16A49F8200962227 /* DOMCSSSupportsRule.h in Headers */ = {isa = PBXBuildFile; fileRef = FCD8832816A49F8200962227 /* DOMCSSSupportsRule.h */; };
68526852 FCD8832B16A49F8200962227 /* DOMCSSSupportsRule.mm in Sources */ = {isa = PBXBuildFile; fileRef = FCD8832916A49F8200962227 /* DOMCSSSupportsRule.mm */; };
68536853 FCD8832C16A49FB000962227 /* DOMCSSSupportsRule.h in Copy Generated Headers */ = {isa = PBXBuildFile; fileRef = FCD8832816A49F8200962227 /* DOMCSSSupportsRule.h */; };

70027002 FD62F52E145898D80094B0ED /* AudioSourceProviderClient.h in Headers */ = {isa = PBXBuildFile; fileRef = FD62F52D145898D80094B0ED /* AudioSourceProviderClient.h */; };
70037003 FD671A77159BB07000197559 /* MediaStreamAudioSourceNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD671A74159BB07000197559 /* MediaStreamAudioSourceNode.cpp */; };
70047004 FD671A78159BB07000197559 /* MediaStreamAudioSourceNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FD671A75159BB07000197559 /* MediaStreamAudioSourceNode.h */; };
7005  FD677738195CAF3D0072E0D3 /* DOMWindowCSS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD677735195CAB200072E0D3 /* DOMWindowCSS.cpp */; };
 7005 FD677738195CAF3D0072E0D3 /* DOMCSSNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD677735195CAB200072E0D3 /* DOMCSSNamespace.cpp */; };
70067006 FD677739195CAFBA0072E0D3 /* CSSSupportsRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD677734195CAB200072E0D3 /* CSSSupportsRule.cpp */; };
70077007 FD67773A195CB14A0072E0D3 /* JSCSSSupportsRule.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD677736195CAB7D0072E0D3 /* JSCSSSupportsRule.cpp */; };
7008  FD67773B195CB1E60072E0D3 /* JSDOMWindowCSS.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD677737195CAB7D0072E0D3 /* JSDOMWindowCSS.cpp */; };
 7008 FD67773B195CB1E60072E0D3 /* JSDOMCSSNamespace.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD677737195CAB7D0072E0D3 /* JSDOMCSSNamespace.cpp */; };
70097009 FD6ED2C3136B8E42003CF072 /* DynamicsCompressorNode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD6ED2C1136B8E42003CF072 /* DynamicsCompressorNode.cpp */; };
70107010 FD6ED2C4136B8E42003CF072 /* DynamicsCompressorNode.h in Headers */ = {isa = PBXBuildFile; fileRef = FD6ED2C2136B8E42003CF072 /* DynamicsCompressorNode.h */; };
70117011 FD6ED2C7136B8E66003CF072 /* DynamicsCompressor.cpp in Sources */ = {isa = PBXBuildFile; fileRef = FD6ED2C5136B8E66003CF072 /* DynamicsCompressor.cpp */; };

1491914919 FC63BDB1167AABAC00F9380F /* CSSSupportsRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CSSSupportsRule.h; sourceTree = "<group>"; };
1492014920 FC63BDB2167AABAC00F9380F /* CSSSupportsRule.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CSSSupportsRule.idl; sourceTree = "<group>"; };
1492114921 FC84802E167AB444008CD100 /* JSCSSSupportsRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSCSSSupportsRule.h; sourceTree = "<group>"; };
14922  FC9A0F72164094CF003D6B8D /* DOMWindowCSS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMWindowCSS.h; sourceTree = "<group>"; };
14923  FC9A0F73164094CF003D6B8D /* DOMWindowCSS.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMWindowCSS.idl; sourceTree = "<group>"; };
14924  FC9E0E4B16419C1E00392BE3 /* JSDOMWindowCSS.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMWindowCSS.h; sourceTree = "<group>"; };
 14922 FC9A0F72164094CF003D6B8D /* DOMCSSNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCSSNamespace.h; sourceTree = "<group>"; };
 14923 FC9A0F73164094CF003D6B8D /* DOMCSSNamespace.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = DOMCSSNamespace.idl; sourceTree = "<group>"; };
 14924 FC9E0E4B16419C1E00392BE3 /* JSDOMCSSNamespace.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSDOMCSSNamespace.h; sourceTree = "<group>"; };
1492514925 FCD8832816A49F8200962227 /* DOMCSSSupportsRule.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCSSSupportsRule.h; sourceTree = "<group>"; };
1492614926 FCD8832916A49F8200962227 /* DOMCSSSupportsRule.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DOMCSSSupportsRule.mm; sourceTree = "<group>"; };
1492714927 FCEBBAAA16A4967A00FA20A6 /* DOMCSSSupportsRuleInternal.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMCSSSupportsRuleInternal.h; sourceTree = "<group>"; };

1509815098 FD671A75159BB07000197559 /* MediaStreamAudioSourceNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MediaStreamAudioSourceNode.h; sourceTree = "<group>"; };
1509915099 FD671A76159BB07000197559 /* MediaStreamAudioSourceNode.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = MediaStreamAudioSourceNode.idl; sourceTree = "<group>"; };
1510015100 FD677734195CAB200072E0D3 /* CSSSupportsRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = CSSSupportsRule.cpp; sourceTree = "<group>"; };
15101  FD677735195CAB200072E0D3 /* DOMWindowCSS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMWindowCSS.cpp; sourceTree = "<group>"; };
 15101 FD677735195CAB200072E0D3 /* DOMCSSNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMCSSNamespace.cpp; sourceTree = "<group>"; };
1510215102 FD677736195CAB7D0072E0D3 /* JSCSSSupportsRule.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSCSSSupportsRule.cpp; path = DerivedSources/WebCore/JSCSSSupportsRule.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
15103  FD677737195CAB7D0072E0D3 /* JSDOMWindowCSS.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMWindowCSS.cpp; path = DerivedSources/WebCore/JSDOMWindowCSS.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
 15103 FD677737195CAB7D0072E0D3 /* JSDOMCSSNamespace.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = JSDOMCSSNamespace.cpp; path = DerivedSources/WebCore/JSDOMCSSNamespace.cpp; sourceTree = BUILT_PRODUCTS_DIR; };
1510415104 FD6ED2C1136B8E42003CF072 /* DynamicsCompressorNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DynamicsCompressorNode.cpp; sourceTree = "<group>"; };
1510515105 FD6ED2C2136B8E42003CF072 /* DynamicsCompressorNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DynamicsCompressorNode.h; sourceTree = "<group>"; };
1510615106 FD6ED2C5136B8E66003CF072 /* DynamicsCompressor.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DynamicsCompressor.cpp; sourceTree = "<group>"; };

2074820748 14CF78A509F58CD800EB3665 /* JSCSSValue.h */,
2074920749 A8D05FA90A23B30F005E7203 /* JSCSSValueList.cpp */,
2075020750 A8D05FAA0A23B30F005E7203 /* JSCSSValueList.h */,
20751  FD677737195CAB7D0072E0D3 /* JSDOMWindowCSS.cpp */,
20752  FC9E0E4B16419C1E00392BE3 /* JSDOMWindowCSS.h */,
 20751 FD677737195CAB7D0072E0D3 /* JSDOMCSSNamespace.cpp */,
 20752 FC9E0E4B16419C1E00392BE3 /* JSDOMCSSNamespace.h */,
2075320753 BC3C39B40C0D3D8D005F4D7A /* JSMediaList.cpp */,
2075420754 BC3C39B50C0D3D8D005F4D7A /* JSMediaList.h */,
2075520755 D3A94A42122DC40F00A37BBC /* JSMediaQueryList.cpp */,

2372723727 A80E6CE10A1989CA007FB8C5 /* DashboardRegion.h */,
2372823728 4A4F48A716B0DFC000EDBB29 /* DocumentRuleSets.cpp */,
2372923729 4A4F48A816B0DFC000EDBB29 /* DocumentRuleSets.h */,
23730  FD677735195CAB200072E0D3 /* DOMWindowCSS.cpp */,
23731  FC9A0F72164094CF003D6B8D /* DOMWindowCSS.h */,
23732  FC9A0F73164094CF003D6B8D /* DOMWindowCSS.idl */,
 23730 FD677735195CAB200072E0D3 /* DOMCSSNamespace.cpp */,
 23731 FC9A0F72164094CF003D6B8D /* DOMCSSNamespace.h */,
 23732 FC9A0F73164094CF003D6B8D /* DOMCSSNamespace.idl */,
2373323733 FBDB619A16D6032A00BB3394 /* ElementRuleCollector.cpp */,
2373423734 FBDB619E16D6036500BB3394 /* ElementRuleCollector.h */,
2373523735 1C66260E1C6E7CA600AB527C /* FontFace.cpp */,

2588125881 5EA3D6E41C859DC100300BBB /* SDPProcessor.h in Headers */,
2588225882 85989DD10ACC8BBD00A0BC51 /* DOMWheelEventInternal.h in Headers */,
2588325883 1403B99709EB13AF00797C7F /* DOMWindow.h in Headers */,
25884  FC9A0F75164094CF003D6B8D /* DOMWindowCSS.h in Headers */,
 25884 FC9A0F75164094CF003D6B8D /* DOMCSSNamespace.h in Headers */,
2588525885 51FA2D78152132B300C1BA0B /* DOMWindowExtension.h in Headers */,
2588625886 5185FC751BB4C4E80012898F /* DOMWindowIndexedDatabase.h in Headers */,
2588725887 97B38E27151C4271004622E9 /* DOMWindowNotifications.h in Headers */,

2653326533 7694563D1214D97C0007CBAE /* JSDOMTokenList.h in Headers */,
2653426534 2E37E00612DBC5A400A6B233 /* JSDOMURL.h in Headers */,
2653526535 BC6932740D7E293900AE44D1 /* JSDOMWindowBase.h in Headers */,
26536  FC9E0E4D16419C1E00392BE3 /* JSDOMWindowCSS.h in Headers */,
 26536 FC9E0E4D16419C1E00392BE3 /* JSDOMCSSNamespace.h in Headers */,
2653726537 652FBBBC0DE27CB60001D386 /* JSDOMWindowCustom.h in Headers */,
2653826538 BCBFB53D0DCD29CF0019B3E5 /* JSDOMWindowShell.h in Headers */,
2653926539 65E0E9441133C89F00B4CB10 /* JSDOMWrapper.h in Headers */,

2959729597 31C0FF4D0E4CEFDD007D6FE5 /* DOMWebKitTransitionEvent.mm in Sources */,
2959829598 85C7F5E80AAFBAFB004014DD /* DOMWheelEvent.mm in Sources */,
2959929599 1403B99809EB13AF00797C7F /* DOMWindow.cpp in Sources */,
29600  FD677738195CAF3D0072E0D3 /* DOMWindowCSS.cpp in Sources */,
 29600 FD677738195CAF3D0072E0D3 /* DOMCSSNamespace.cpp in Sources */,
2960129601 517FBA1E151AB17C00B57959 /* DOMWindowExtension.cpp in Sources */,
2960229602 5185FC741BB4C4E80012898F /* DOMWindowIndexedDatabase.cpp in Sources */,
2960329603 97B38E28151C4273004622E9 /* DOMWindowNotifications.cpp in Sources */,

3021930219 2E37E00512DBC5A400A6B233 /* JSDOMURL.cpp in Sources */,
3022030220 1403BA0C09EB18C700797C7F /* JSDOMWindow.cpp in Sources */,
3022130221 BC6932730D7E293900AE44D1 /* JSDOMWindowBase.cpp in Sources */,
30222  FD67773B195CB1E60072E0D3 /* JSDOMWindowCSS.cpp in Sources */,
 30222 FD67773B195CB1E60072E0D3 /* JSDOMCSSNamespace.cpp in Sources */,
3022330223 BCD9C2620C17AA67005C90A2 /* JSDOMWindowCustom.cpp in Sources */,
3022430224 BCBFB53C0DCD29CF0019B3E5 /* JSDOMWindowShell.cpp in Sources */,
3022530225 FD7868B9136B999200D403DF /* JSDynamicsCompressorNode.cpp in Sources */,
199108

Source/WebCore/css/DOMCSSNamespace.cpp

 1/*
 2 * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions are
 6 * met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above
 11 * copyright notice, this list of conditions and the following disclaimer in
 12 * the documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Motorola Mobility Inc. nor the names of its
 14 * contributors may be used to endorse or promote products derived from this
 15 * software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 28 */
 29
 30#include "config.h"
 31#include "DOMWindowCSS.h"
 32
 33#include "CSSParser.h"
 34#include "StyleProperties.h"
 35#include <wtf/text/WTFString.h>
 36
 37namespace WebCore {
 38
 39Ref<DOMWindowCSS> DOMWindowCSS::create()
 40{
 41 return adoptRef(*new DOMWindowCSS);
 42}
 43
 44static String valueWithoutImportant(const String& value)
 45{
 46 if (!value.endsWith("important", false))
 47 return value;
 48
 49 String newValue = value;
 50 int bangIndex = newValue.length() - 9 - 1;
 51 if (newValue[bangIndex] == ' ')
 52 bangIndex--;
 53 newValue = newValue.left(bangIndex);
 54
 55 return newValue;
 56}
 57
 58bool DOMWindowCSS::supports(const String& property, const String& value) const
 59{
 60 CSSPropertyID propertyID = cssPropertyID(property.stripWhiteSpace());
 61
 62 if (propertyID == CSSPropertyInvalid)
 63 return false;
 64
 65 // CSSParser::parseValue() won't work correctly if !important is present,
 66 // so just get rid of it. It doesn't matter to supports() if it's actually
 67 // there or not, provided how it's specified in the value is correct.
 68 String normalizedValue = value.stripWhiteSpace().simplifyWhiteSpace();
 69 normalizedValue = valueWithoutImportant(normalizedValue);
 70
 71 if (normalizedValue.isEmpty())
 72 return false;
 73
 74 RefPtr<MutableStyleProperties> dummyStyle = MutableStyleProperties::create();
 75 return CSSParser::parseValue(dummyStyle.get(), propertyID, normalizedValue, false, CSSStrictMode, nullptr) != CSSParser::ParseResult::Error;
 76}
 77
 78bool DOMWindowCSS::supports(const String& conditionText) const
 79{
 80 CSSParserContext context(CSSStrictMode);
 81 CSSParser parser(context);
 82 return parser.parseSupportsCondition(conditionText);
 83}
 84
 85}
199071

Source/WebCore/css/DOMCSSNamespace.cpp

2828 */
2929
3030#include "config.h"
31 #include "DOMWindowCSS.h"
 31#include "DOMCSSNamespace.h"
3232
3333#include "CSSParser.h"
3434#include "StyleProperties.h"

3636
3737namespace WebCore {
3838
39 Ref<DOMWindowCSS> DOMWindowCSS::create()
40 {
41  return adoptRef(*new DOMWindowCSS);
42 }
43 
4439static String valueWithoutImportant(const String& value)
4540{
4641 if (!value.endsWith("important", false))

@@static String valueWithoutImportant(cons
5550 return newValue;
5651}
5752
58 bool DOMWindowCSS::supports(const String& property, const String& value) const
 53bool DOMCSSNamespace::supports(const String& property, const String& value)
5954{
6055 CSSPropertyID propertyID = cssPropertyID(property.stripWhiteSpace());
6156

@@bool DOMWindowCSS::supports(const String
7570 return CSSParser::parseValue(dummyStyle.get(), propertyID, normalizedValue, false, CSSStrictMode, nullptr) != CSSParser::ParseResult::Error;
7671}
7772
78 bool DOMWindowCSS::supports(const String& conditionText) const
 73bool DOMCSSNamespace::supports(const String& conditionText)
7974{
8075 CSSParserContext context(CSSStrictMode);
8176 CSSParser parser(context);
working copy

Source/WebCore/css/DOMCSSNamespace.h

 1/*
 2 * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions are
 6 * met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above
 11 * copyright notice, this list of conditions and the following disclaimer in
 12 * the documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Motorola Mobility Inc. nor the names of its
 14 * contributors may be used to endorse or promote products derived from this
 15 * software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 28 */
 29
 30#ifndef DOMWindowCSS_h
 31#define DOMWindowCSS_h
 32
 33#include <wtf/Forward.h>
 34#include <wtf/Ref.h>
 35#include <wtf/RefCounted.h>
 36
 37namespace WebCore {
 38
 39class DOMWindowCSS : public RefCounted<DOMWindowCSS> {
 40public:
 41 WEBCORE_EXPORT static Ref<DOMWindowCSS> create();
 42
 43 bool supports(const String& property, const String& value) const;
 44 bool supports(const String& conditionText) const;
 45
 46private:
 47 DOMWindowCSS()
 48 {
 49 }
 50};
 51
 52}
 53
 54#endif
199071

Source/WebCore/css/DOMCSSNamespace.h

2727 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
2828 */
2929
30 #ifndef DOMWindowCSS_h
31 #define DOMWindowCSS_h
 30#pragma once
3231
3332#include <wtf/Forward.h>
34 #include <wtf/Ref.h>
3533#include <wtf/RefCounted.h>
3634
3735namespace WebCore {
3836
39 class DOMWindowCSS : public RefCounted<DOMWindowCSS> {
 37class DOMCSSNamespace : public RefCounted<DOMCSSNamespace> {
4038public:
41  WEBCORE_EXPORT static Ref<DOMWindowCSS> create();
42 
43  bool supports(const String& property, const String& value) const;
44  bool supports(const String& conditionText) const;
45 
46 private:
47  DOMWindowCSS()
48  {
49  }
 39 static bool supports(const String& property, const String& value);
 40 static bool supports(const String& conditionText);
5041};
5142
5243}
53 
54 #endif
working copy

Source/WebCore/css/DOMCSSNamespace.idl

 1/*
 2 * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
 3 *
 4 * Redistribution and use in source and binary forms, with or without
 5 * modification, are permitted provided that the following conditions are
 6 * met:
 7 *
 8 * 1. Redistributions of source code must retain the above copyright
 9 * notice, this list of conditions and the following disclaimer.
 10 * 2. Redistributions in binary form must reproduce the above
 11 * copyright notice, this list of conditions and the following disclaimer in
 12 * the documentation and/or other materials provided with the distribution.
 13 * 3. Neither the name of Motorola Mobility Inc. nor the names of its
 14 * contributors may be used to endorse or promote products derived from this
 15 * software without specific prior written permission.
 16 *
 17 * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
 18 * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
 19 * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
 20 * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
 21 * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 22 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
 23 * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 24 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 25 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
 27 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 28 */
 29
 30[
 31 NoInterfaceObject,
 32 InterfaceName=CSS,
 33 ImplementationLacksVTable,
 34] interface DOMWindowCSS {
 35
 36 boolean supports(DOMString property, DOMString value);
 37 boolean supports(DOMString conditionText);
 38
 39};
 40
199071

Source/WebCore/css/DOMCSSNamespace.idl

2828 */
2929
3030[
31  NoInterfaceObject,
3231 InterfaceName=CSS,
3332 ImplementationLacksVTable,
34 ] interface DOMWindowCSS {
35 
36  boolean supports(DOMString property, DOMString value);
37  boolean supports(DOMString conditionText);
38 
 33] interface DOMCSSNamespace {
 34 static boolean supports(DOMString property, DOMString value);
 35 static boolean supports(DOMString conditionText);
3936};
40 
working copy

Source/WebCore/css/DOMWindowCSS.cpp

1 /*
2  * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer in
12  * the documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of Motorola Mobility Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #include "config.h"
31 #include "DOMWindowCSS.h"
32 
33 #include "CSSParser.h"
34 #include "StyleProperties.h"
35 #include <wtf/text/WTFString.h>
36 
37 namespace WebCore {
38 
39 Ref<DOMWindowCSS> DOMWindowCSS::create()
40 {
41  return adoptRef(*new DOMWindowCSS);
42 }
43 
44 static String valueWithoutImportant(const String& value)
45 {
46  if (!value.endsWith("important", false))
47  return value;
48 
49  String newValue = value;
50  int bangIndex = newValue.length() - 9 - 1;
51  if (newValue[bangIndex] == ' ')
52  bangIndex--;
53  newValue = newValue.left(bangIndex);
54 
55  return newValue;
56 }
57 
58 bool DOMWindowCSS::supports(const String& property, const String& value) const
59 {
60  CSSPropertyID propertyID = cssPropertyID(property.stripWhiteSpace());
61 
62  if (propertyID == CSSPropertyInvalid)
63  return false;
64 
65  // CSSParser::parseValue() won't work correctly if !important is present,
66  // so just get rid of it. It doesn't matter to supports() if it's actually
67  // there or not, provided how it's specified in the value is correct.
68  String normalizedValue = value.stripWhiteSpace().simplifyWhiteSpace();
69  normalizedValue = valueWithoutImportant(normalizedValue);
70 
71  if (normalizedValue.isEmpty())
72  return false;
73 
74  RefPtr<MutableStyleProperties> dummyStyle = MutableStyleProperties::create();
75  return CSSParser::parseValue(dummyStyle.get(), propertyID, normalizedValue, false, CSSStrictMode, nullptr) != CSSParser::ParseResult::Error;
76 }
77 
78 bool DOMWindowCSS::supports(const String& conditionText) const
79 {
80  CSSParserContext context(CSSStrictMode);
81  CSSParser parser(context);
82  return parser.parseSupportsCondition(conditionText);
83 }
84 
85 }
199108

Source/WebCore/css/DOMWindowCSS.h

1 /*
2  * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer in
12  * the documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of Motorola Mobility Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 #ifndef DOMWindowCSS_h
31 #define DOMWindowCSS_h
32 
33 #include <wtf/Forward.h>
34 #include <wtf/Ref.h>
35 #include <wtf/RefCounted.h>
36 
37 namespace WebCore {
38 
39 class DOMWindowCSS : public RefCounted<DOMWindowCSS> {
40 public:
41  WEBCORE_EXPORT static Ref<DOMWindowCSS> create();
42 
43  bool supports(const String& property, const String& value) const;
44  bool supports(const String& conditionText) const;
45 
46 private:
47  DOMWindowCSS()
48  {
49  }
50 };
51 
52 }
53 
54 #endif
199108

Source/WebCore/css/DOMWindowCSS.idl

1 /*
2  * Copyright (C) 2012 Motorola Mobility Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions are
6  * met:
7  *
8  * 1. Redistributions of source code must retain the above copyright
9  * notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above
11  * copyright notice, this list of conditions and the following disclaimer in
12  * the documentation and/or other materials provided with the distribution.
13  * 3. Neither the name of Motorola Mobility Inc. nor the names of its
14  * contributors may be used to endorse or promote products derived from this
15  * software without specific prior written permission.
16  *
17  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
18  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
19  * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
20  * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
21  * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
22  * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
23  * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
24  * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
25  * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
27  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28  */
29 
30 [
31  NoInterfaceObject,
32  InterfaceName=CSS,
33  ImplementationLacksVTable,
34 ] interface DOMWindowCSS {
35 
36  boolean supports(DOMString property, DOMString value);
37  boolean supports(DOMString conditionText);
38 
39 };
40 
199108

Source/WebCore/page/DOMWindow.cpp

4444#include "DOMTimer.h"
4545#include "DOMTokenList.h"
4646#include "DOMURL.h"
47 #include "DOMWindowCSS.h"
4847#include "DOMWindowExtension.h"
4948#include "DOMWindowNotifications.h"
5049#include "DeviceMotionController.h"

@@void DOMWindow::cancelAnimationFrame(int
16701669}
16711670#endif
16721671
1673 DOMWindowCSS* DOMWindow::css()
1674 {
1675  if (!m_css)
1676  m_css = DOMWindowCSS::create();
1677  return m_css.get();
1678 }
1679 
16801672static void didAddStorageEventListener(DOMWindow* window)
16811673{
16821674 // Creating these WebCore::Storage objects informs the system that we'd like to receive
199108

Source/WebCore/page/DOMWindow.h

@@namespace WebCore {
5050 class DOMApplicationCache;
5151 class DOMSelection;
5252 class DOMURL;
53  class DOMWindowCSS;
5453 class DOMWindowProperty;
5554 class DOMWrapperWorld;
5655 class Database;

@@namespace WebCore {
272271 void cancelAnimationFrame(int id);
273272#endif
274273
275  DOMWindowCSS* css();
276 
277274 // Events
278275 // EventTarget API
279276 bool addEventListener(const AtomicString& eventType, RefPtr<EventListener>&&, bool useCapture) override;

@@namespace WebCore {
417414 mutable RefPtr<Performance> m_performance;
418415#endif
419416
420  mutable RefPtr<DOMWindowCSS> m_css;
421 
422417#if ENABLE(USER_MESSAGE_HANDLERS)
423418 mutable RefPtr<WebKitNamespace> m_webkitNamespace;
424419#endif
199108

Source/WebCore/page/DOMWindow.idl

179179 [Conditional=REQUEST_ANIMATION_FRAME, ImplementedAs=cancelAnimationFrame] void webkitCancelAnimationFrame(long id);
180180 [Conditional=REQUEST_ANIMATION_FRAME, ImplementedAs=cancelAnimationFrame] void webkitCancelRequestAnimationFrame(long id); // This is a deprecated alias for webkitCancelAnimationFrame(). Remove this when removing vendor prefix.
181181
182  [Replaceable] readonly attribute DOMWindowCSS CSS;
183 
184182 void captureEvents(/*in long eventFlags*/);
185183 void releaseEvents(/*in long eventFlags*/);
186184
199108

LayoutTests/ChangeLog

 12016-04-06 Sam Weinig <sam@webkit.org>
 2
 3 window.CSS should be a constructor with static functions
 4 https://bugs.webkit.org/show_bug.cgi?id=156294
 5
 6 Reviewed by NOBODY (OOPS!).
 7
 8 * platform/mac/js/dom/global-constructors-attributes-expected.txt:
 9 Update for new CSS constructor property.
 10
1112016-04-06 Keith Miller <keith_miller@apple.com>
212
313 RegExp constructor should use Symbol.match and other properties
199108

LayoutTests/platform/mac/js/dom/global-constructors-attributes-expected.txt

@@PASS Object.getOwnPropertyDescriptor(glo
123123PASS Object.getOwnPropertyDescriptor(global, 'CDATASection').hasOwnProperty('set') is false
124124PASS Object.getOwnPropertyDescriptor(global, 'CDATASection').enumerable is false
125125PASS Object.getOwnPropertyDescriptor(global, 'CDATASection').configurable is true
 126PASS Object.getOwnPropertyDescriptor(global, 'CSS').value is CSS
 127PASS Object.getOwnPropertyDescriptor(global, 'CSS').hasOwnProperty('get') is false
 128PASS Object.getOwnPropertyDescriptor(global, 'CSS').hasOwnProperty('set') is false
 129PASS Object.getOwnPropertyDescriptor(global, 'CSS').enumerable is false
 130PASS Object.getOwnPropertyDescriptor(global, 'CSS').configurable is true
126131PASS Object.getOwnPropertyDescriptor(global, 'CSSCharsetRule').value is CSSCharsetRule
127132PASS Object.getOwnPropertyDescriptor(global, 'CSSCharsetRule').hasOwnProperty('get') is false
128133PASS Object.getOwnPropertyDescriptor(global, 'CSSCharsetRule').hasOwnProperty('set') is false
199108