Changeset 215597 in webkit
- Timestamp:
- Apr 20, 2017, 6:00:46 PM (8 years ago)
- Location:
- trunk
- Files:
-
- 12 added
- 14 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r215591 r215597 1 2017-04-20 Timothy Horton <[email protected]> 2 3 Expose obscured insets to web content (as "safe area insets") 4 https://bugs.webkit.org/show_bug.cgi?id=171013 5 <rdar://problem/31564652> 6 7 Reviewed by Wenson Hsieh and Dave Hyatt. 8 9 * TestExpectations: 10 * fast/css/variables/constants/invalid-constant-name-fallback-expected.html: Added. 11 * fast/css/variables/constants/invalid-constant-name-fallback.html: Added. 12 * fast/css/variables/constants/ios/safe-area-inset-set-expected.html: Added. 13 * fast/css/variables/constants/ios/safe-area-inset-set.html: Added. 14 * fast/css/variables/constants/safe-area-inset-cannot-override-expected.html: Added. 15 * fast/css/variables/constants/safe-area-inset-cannot-override.html: Added. 16 * fast/css/variables/constants/safe-area-inset-zero-expected.html: Added. 17 * fast/css/variables/constants/safe-area-inset-zero.html: Added. 18 * platform/ios-wk2/TestExpectations: 19 1 20 2017-04-20 Ryan Haddad <[email protected]> 2 21 -
trunk/LayoutTests/TestExpectations
r215590 r215597 35 35 media/controls/ipad [ Skip ] 36 36 fast/text-autosizing [ Skip ] 37 fast/css/variables/constants/ios [ Skip ] 37 38 38 39 # window.showModalDialog is only tested in DumpRenderTree on Mac. -
trunk/LayoutTests/platform/ios-wk2/TestExpectations
r215348 r215597 15 15 tiled-drawing/ios [ Pass ] 16 16 editing/selection/character-granularity-rect.html [ Pass ] 17 fast/css/variables/constants/ios [ Pass ] 17 18 18 19 fast/media/mq-inverted-colors-live-update.html [ Pass ] -
trunk/Source/WebCore/CMakeLists.txt
r215492 r215597 1454 1454 dom/ComposedTreeIterator.cpp 1455 1455 dom/CompositionEvent.cpp 1456 dom/ConstantPropertyMap.cpp 1456 1457 dom/ContainerNode.cpp 1457 1458 dom/ContainerNodeAlgorithms.cpp -
trunk/Source/WebCore/ChangeLog
r215588 r215597 1 2017-04-20 Timothy Horton <[email protected]> 2 3 Expose obscured insets to web content (as "safe area insets") 4 https://bugs.webkit.org/show_bug.cgi?id=171013 5 <rdar://problem/31564652> 6 7 Reviewed by Wenson Hsieh and Dave Hyatt. 8 9 Tests: fast/css/variables/constants/invalid-constant-name-fallback.html 10 fast/css/variables/constants/ios/safe-area-inset-set.html 11 fast/css/variables/constants/safe-area-inset-cannot-override.html 12 fast/css/variables/constants/safe-area-inset-zero.html 13 14 * CMakeLists.txt: 15 * WebCore.xcodeproj/project.pbxproj: 16 * css/CSSValueKeywords.in: 17 * css/CSSVariableData.cpp: 18 (WebCore::CSSVariableData::checkVariablesForCyclesWithRange): 19 (WebCore::CSSVariableData::resolveTokenRange): 20 * css/parser/CSSVariableParser.cpp: 21 (WebCore::isValidConstantName): 22 (WebCore::classifyBlock): 23 (WebCore::isValidConstantReference): 24 Add a constant() function, which takes both custom properties and 25 arbitrary idents which are looked up in ConstantPropertyMap, allowing 26 fallback from the arbitrary, UA-defined idents to custom properties. 27 28 * dom/ConstantPropertyMap.cpp: Added. 29 (WebCore::ConstantPropertyMap::ConstantPropertyMap): 30 (WebCore::ConstantPropertyMap::values): 31 (WebCore::ConstantPropertyMap::nameForProperty): 32 (WebCore::ConstantPropertyMap::setValueForProperty): 33 (WebCore::ConstantPropertyMap::buildValues): 34 (WebCore::variableDataForSafeAreaInset): 35 (WebCore::ConstantPropertyMap::didChangeObscuredInsets): 36 * dom/ConstantPropertyMap.h: Added. 37 Keep a mapping of UA-defined "constants", which can be looked up 38 from CSS via the aforementioned function. For now, this mapping 39 includes only safe-area-inset-{top, right, bottom, left}, which 40 expose the obscured insets (now that they can be painted into via 41 the viewport parameter clip-to-safe-area-inset=no). 42 43 * dom/Document.cpp: 44 (WebCore::Document::Document): 45 (WebCore::Document::didChangeObscuredInsets): 46 * dom/Document.h: 47 (WebCore::Document::constantProperties): 48 * page/Page.cpp: 49 (WebCore::Page::setObscuredInsets): 50 * page/Page.h: 51 (WebCore::Page::setObscuredInsets): Deleted. 52 Make setObscuredInsets and related storage not iOS-specific, though 53 nothing from the other platforms yet calls this code. 54 55 * style/StyleResolveForDocument.cpp: 56 (WebCore::Style::resolveForDocument): 57 Grab the constant properties from ConstantPropertyMap and plop them into 58 the CustomPropertyValueMap. Constant properties aren't allowed to start 59 with --, and variable properties must, so there is no opportunity here 60 for exposing things to var() (or allowing custom properties to override 61 UA-defined constant properties). 62 1 63 2017-04-20 Anders Carlsson <[email protected]> 2 64 -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r215548 r215597 1259 1259 2D9BF74A1DBFDDFF007A7D99 /* JSMediaKeySessionCustom.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D9BF7481DBFDDF8007A7D99 /* JSMediaKeySessionCustom.cpp */; }; 1260 1260 2D9F0E1314FF1CBF00BA0FF7 /* linearSRGB.icc in Resources */ = {isa = PBXBuildFile; fileRef = 2D9F0E1214FF1CBF00BA0FF7 /* linearSRGB.icc */; }; 1261 2DAF343C1EA7E0F100382CD3 /* ConstantPropertyMap.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2DAF343A1EA7E0F100382CD3 /* ConstantPropertyMap.cpp */; }; 1262 2DAF343D1EA7E0F100382CD3 /* ConstantPropertyMap.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DAF343B1EA7E0F100382CD3 /* ConstantPropertyMap.h */; }; 1261 1263 2DB9C4AA1B3231F40070F27F /* NSEventSPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DB9C4A91B3231F40070F27F /* NSEventSPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1262 1264 2DC4CF791D2DD98900ECCC94 /* DataDetectorsUISPI.h in Headers */ = {isa = PBXBuildFile; fileRef = 2DC4CF781D2DD98900ECCC94 /* DataDetectorsUISPI.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 8801 8803 2DAAE32C19DCAF6000E002D2 /* MockPageOverlayClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = MockPageOverlayClient.cpp; sourceTree = "<group>"; }; 8802 8804 2DAAE32D19DCAF6000E002D2 /* MockPageOverlayClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = MockPageOverlayClient.h; sourceTree = "<group>"; }; 8805 2DAF343A1EA7E0F100382CD3 /* ConstantPropertyMap.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ConstantPropertyMap.cpp; sourceTree = "<group>"; }; 8806 2DAF343B1EA7E0F100382CD3 /* ConstantPropertyMap.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ConstantPropertyMap.h; sourceTree = "<group>"; }; 8803 8807 2DB9C4A91B3231F40070F27F /* NSEventSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NSEventSPI.h; sourceTree = "<group>"; }; 8804 8808 2DC4CF781D2DD98900ECCC94 /* DataDetectorsUISPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DataDetectorsUISPI.h; sourceTree = "<group>"; }; … … 25456 25460 79F2F59F1091939A000D87CB /* CompositionEvent.h */, 25457 25461 79F2F5A01091939A000D87CB /* CompositionEvent.idl */, 25462 2DAF343A1EA7E0F100382CD3 /* ConstantPropertyMap.cpp */, 25463 2DAF343B1EA7E0F100382CD3 /* ConstantPropertyMap.h */, 25458 25464 A81872140977D3C0005826D9 /* ContainerNode.cpp */, 25459 25465 A81872110977D3C0005826D9 /* ContainerNode.h */, … … 26488 26494 E1C94AF9191303F000D5A893 /* BlobPart.h in Headers */, 26489 26495 7C77C3D11DEE472400A50BFA /* BlobPropertyBag.h in Headers */, 26496 2DAF343D1EA7E0F100382CD3 /* ConstantPropertyMap.h in Headers */, 26490 26497 2EDEF1F5121B0EFC00726DB2 /* BlobRegistry.h in Headers */, 26491 26498 2EDEF1F7121B0EFC00726DB2 /* BlobRegistryImpl.h in Headers */, … … 31833 31840 BC17F9660B64EBB8004A65CB /* JSHTMLSelectElementCustom.cpp in Sources */, 31834 31841 9B69D3B81B99100700E3512B /* JSHTMLSlotElement.cpp in Sources */, 31842 2DAF343C1EA7E0F100382CD3 /* ConstantPropertyMap.cpp in Sources */, 31835 31843 E446143B0CD689CC00FADA75 /* JSHTMLSourceElement.cpp in Sources */, 31836 31844 9752D38D1413104B003305BD /* JSHTMLSpanElement.cpp in Sources */, -
trunk/Source/WebCore/css/CSSValueKeywords.in
r215146 r215597 845 845 846 846 // 847 // UA Constants 848 // 849 constant 850 851 // 847 852 // CSS_PROP_BREAK_BEFORE/AFTER/INSIDE 848 853 // -
trunk/Source/WebCore/css/CSSVariableData.cpp
r209666 r215597 102 102 { 103 103 while (!range.atEnd()) { 104 if (range.peek().functionId() == CSSValueVar ) {104 if (range.peek().functionId() == CSSValueVar || range.peek().functionId() == CSSValueConstant) { 105 105 CSSParserTokenRange block = range.consumeBlock(); 106 106 … … 172 172 bool success = true; 173 173 while (!range.atEnd()) { 174 if (range.peek().functionId() == CSSValueVar )174 if (range.peek().functionId() == CSSValueVar || range.peek().functionId() == CSSValueConstant) 175 175 success &= resolveVariableReference(customProperties, range.consumeBlock(), result); 176 176 else -
trunk/Source/WebCore/css/parser/CSSVariableParser.cpp
r208006 r215597 50 50 } 51 51 52 static bool isValidConstantName(const CSSParserToken& token) 53 { 54 return token.type() == IdentToken; 55 } 56 52 57 bool isValidVariableReference(CSSParserTokenRange, bool& hasAtApplyRule); 58 bool isValidConstantReference(CSSParserTokenRange, bool& hasAtApplyRule); 53 59 54 60 static bool classifyBlock(CSSParserTokenRange range, bool& hasReferences, bool& hasAtApplyRule, bool isTopLevelBlock = true) … … 60 66 if (token.functionId() == CSSValueVar) { 61 67 if (!isValidVariableReference(block, hasAtApplyRule)) 68 return false; // Bail if any references are invalid 69 hasReferences = true; 70 continue; 71 } 72 if (token.functionId() == CSSValueConstant) { 73 if (!isValidConstantReference(block, hasAtApplyRule)) 62 74 return false; // Bail if any references are invalid 63 75 hasReferences = true; … … 123 135 } 124 136 137 bool isValidConstantReference(CSSParserTokenRange range, bool& hasAtApplyRule) 138 { 139 range.consumeWhitespace(); 140 if (!isValidConstantName(range.consumeIncludingWhitespace())) 141 return false; 142 if (range.atEnd()) 143 return true; 144 145 if (range.consume().type() != CommaToken) 146 return false; 147 if (range.atEnd()) 148 return false; 149 150 bool hasReferences = false; 151 return classifyBlock(range, hasReferences, hasAtApplyRule); 152 } 153 125 154 static CSSValueID classifyVariableRange(CSSParserTokenRange range, bool& hasReferences, bool& hasAtApplyRule) 126 155 { -
trunk/Source/WebCore/dom/Document.cpp
r215486 r215597 44 44 #include "CommonVM.h" 45 45 #include "CompositionEvent.h" 46 #include "ConstantPropertyMap.h" 46 47 #include "ContentSecurityPolicy.h" 47 48 #include "CookieJar.h" … … 453 454 , m_moduleLoader(std::make_unique<ScriptModuleLoader>(*this)) 454 455 , m_xmlVersion(ASCIILiteral("1.0")) 456 , m_constantPropertyMap(std::make_unique<ConstantPropertyMap>(*this)) 455 457 , m_documentClasses(documentClasses) 456 458 , m_eventQueue(*this) … … 2051 2053 void Document::fontsNeedUpdate(FontSelector&) 2052 2054 { 2055 invalidateMatchedPropertiesCacheAndForceStyleRecalc(); 2056 } 2057 2058 void Document::invalidateMatchedPropertiesCacheAndForceStyleRecalc() 2059 { 2053 2060 if (auto* resolver = styleScope().resolverIfExists()) 2054 2061 resolver->invalidateMatchedPropertiesCache(); -
trunk/Source/WebCore/dom/Document.h
r215486 r215597 74 74 class Attr; 75 75 class CDATASection; 76 class CSSCustomPropertyValue; 76 77 class CSSFontSelector; 77 78 class CSSStyleDeclaration; … … 84 85 class CharacterData; 85 86 class Comment; 87 class ConstantPropertyMap; 86 88 class DOMImplementation; 87 89 class DOMNamedFlowCollection; … … 1207 1209 DocumentSharedObjectPool* sharedObjectPool() { return m_sharedObjectPool.get(); } 1208 1210 1211 void invalidateMatchedPropertiesCacheAndForceStyleRecalc(); 1212 1209 1213 void didRemoveAllPendingStylesheet(); 1210 1214 void didClearStyleResolver(); … … 1300 1304 void detachFromCachedFrame(CachedFrameBase&); 1301 1305 1306 ConstantPropertyMap& constantProperties() const { return *m_constantPropertyMap; } 1307 1302 1308 protected: 1303 1309 enum ConstructionFlags { Synthesized = 1, NonRenderedPlaceholder = 1 << 1 }; … … 1535 1541 1536 1542 DocumentOrderedMap m_imagesByUsemap; 1543 1544 std::unique_ptr<ConstantPropertyMap> m_constantPropertyMap; 1537 1545 1538 1546 std::unique_ptr<SelectorQueryCache> m_selectorQueryCache; -
trunk/Source/WebCore/page/Page.cpp
r215582 r215597 30 30 #include "ChromeClient.h" 31 31 #include "ClientRectList.h" 32 #include "ConstantPropertyMap.h" 32 33 #include "ContextMenuClient.h" 33 34 #include "ContextMenuController.h" … … 2290 2291 } 2291 2292 2293 void Page::setObscuredInsets(const FloatBoxExtent& insets) 2294 { 2295 if (m_obscuredInsets == insets) 2296 return; 2297 2298 m_obscuredInsets = insets; 2299 2300 for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) { 2301 if (!frame->document()) 2302 continue; 2303 frame->document()->constantProperties().didChangeObscuredInsets(); 2304 } 2305 } 2306 2292 2307 #if ENABLE(DATA_INTERACTION) 2293 2308 -
trunk/Source/WebCore/page/Page.h
r215446 r215597 330 330 WEBCORE_EXPORT void setTopContentInset(float); 331 331 332 const FloatBoxExtent& obscuredInsets() const { return m_obscuredInsets; } 333 WEBCORE_EXPORT void setObscuredInsets(const FloatBoxExtent&); 334 332 335 #if PLATFORM(IOS) 333 const FloatBoxExtent& obscuredInsets() const { return m_obscuredInsets; }334 void setObscuredInsets(FloatBoxExtent insets) { m_obscuredInsets = insets; }335 336 336 bool enclosedInScrollableAncestorView() const { return m_enclosedInScrollableAncestorView; } 337 337 void setEnclosedInScrollableAncestorView(bool f) { m_enclosedInScrollableAncestorView = f; } … … 687 687 688 688 float m_topContentInset; 689 FloatBoxExtent m_obscuredInsets; 689 690 690 691 #if PLATFORM(IOS) 691 // This is only used for history scroll position restoration.692 FloatBoxExtent m_obscuredInsets;693 692 bool m_enclosedInScrollableAncestorView { false }; 694 693 #endif -
trunk/Source/WebCore/style/StyleResolveForDocument.cpp
r210436 r215597 31 31 32 32 #include "CSSFontSelector.h" 33 #include "ConstantPropertyMap.h" 33 34 #include "Document.h" 34 35 #include "Frame.h" … … 125 126 documentStyle.fontCascade().update(&const_cast<Document&>(document).fontSelector()); 126 127 128 for (auto& it : document.constantProperties().values()) 129 documentStyle.setCustomPropertyValue(it.key, makeRef(it.value.get())); 130 127 131 return documentStyle; 128 132 }
Note:
See TracChangeset
for help on using the changeset viewer.