Changeset 283858 in webkit
- Timestamp:
- Oct 8, 2021 6:39:28 PM (9 months ago)
- Location:
- trunk
- Files:
-
- 14 edited
-
LayoutTests/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/ChangeLog (modified) (1 diff)
-
LayoutTests/imported/w3c/web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt (modified) (1 diff)
-
LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt (modified) (1 diff)
-
LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt (modified) (1 diff)
-
LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt (modified) (1 diff)
-
Source/WebCore/ChangeLog (modified) (1 diff)
-
Source/WebCore/css/CSSPrimitiveValueMappings.h (modified) (2 diffs)
-
Source/WebCore/css/CSSProperties.json (modified) (1 diff)
-
Source/WebCore/css/parser/CSSParserFastPaths.cpp (modified) (1 diff)
-
Source/WebCore/platform/ThemeTypes.cpp (modified) (1 diff)
-
Source/WebCore/platform/ThemeTypes.h (modified) (1 diff)
-
Source/WebCore/rendering/RenderTheme.cpp (modified) (6 diffs)
-
Source/WebCore/rendering/RenderTheme.h (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r283836 r283858 1 2021-10-08 Aditya Keerthi <akeerthi@apple.com> 2 3 Add support for '-webkit-appearance: auto' 4 https://bugs.webkit.org/show_bug.cgi?id=231203 5 rdar://83696133 6 7 Reviewed by Wenson Hsieh. 8 9 * platform/gtk/imported/w3c/web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt: 10 * platform/ios-wk2/imported/w3c/web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt: 11 * platform/wpe/imported/w3c/web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt: 12 1 13 2021-10-08 Ayumi Kojima <ayumi_kojima@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/ChangeLog
r283825 r283858 1 2021-10-08 Aditya Keerthi <akeerthi@apple.com> 2 3 Add support for '-webkit-appearance: auto' 4 https://bugs.webkit.org/show_bug.cgi?id=231203 5 rdar://83696133 6 7 Reviewed by Wenson Hsieh. 8 9 * web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt: 10 11 Mark progression. 12 1 13 2021-10-08 Chris Dumez <cdumez@apple.com> 2 14 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt
r283269 r283858 2 2 3 3 PASS -webkit-appearance: none 4 FAIL -webkit-appearance: auto assert_equals: style.WebkitAppearance (uppercase W) expected "auto" but got "" 4 PASS -webkit-appearance: auto 5 5 PASS -webkit-appearance: button 6 6 PASS -webkit-appearance: checkbox -
trunk/LayoutTests/platform/gtk/imported/w3c/web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt
r283269 r283858 2 2 3 3 PASS -webkit-appearance: none 4 FAIL -webkit-appearance: auto assert_equals: style.WebkitAppearance (uppercase W) expected "auto" but got "" 4 PASS -webkit-appearance: auto 5 5 PASS -webkit-appearance: button 6 6 PASS -webkit-appearance: checkbox -
trunk/LayoutTests/platform/ios-wk2/imported/w3c/web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt
r283269 r283858 2 2 3 3 PASS -webkit-appearance: none 4 FAIL -webkit-appearance: auto assert_equals: style.WebkitAppearance (uppercase W) expected "auto" but got "" 4 PASS -webkit-appearance: auto 5 5 PASS -webkit-appearance: button 6 6 PASS -webkit-appearance: checkbox -
trunk/LayoutTests/platform/wpe/imported/w3c/web-platform-tests/css/css-ui/appearance-cssom-001-expected.txt
r283269 r283858 2 2 3 3 PASS -webkit-appearance: none 4 FAIL -webkit-appearance: auto assert_equals: style.WebkitAppearance (uppercase W) expected "auto" but got "" 4 PASS -webkit-appearance: auto 5 5 PASS -webkit-appearance: button 6 6 PASS -webkit-appearance: checkbox -
trunk/Source/WebCore/ChangeLog
r283857 r283858 1 2021-10-08 Aditya Keerthi <akeerthi@apple.com> 2 3 Add support for '-webkit-appearance: auto' 4 https://bugs.webkit.org/show_bug.cgi?id=231203 5 rdar://83696133 6 7 Reviewed by Wenson Hsieh. 8 9 The 'appearance' property allows authors to use the 'auto' keyword 10 to opt widgets (any element that can have a native appearance) into 11 a native appearance [1]. Elements other than widgets are rendered 12 as if none had been specified. 13 14 Since '-webkit-appearance' is a parse time alias of 'appearance', 15 support '-webkit-appearance: auto' prior to unprefixing. 16 17 The used-value for appearance (effectiveAppearance) is determined by 18 the element tag and type. In the case of elements in the UA shadow 19 tree, the pseudo id is used to determine the effective appearance. The 20 used-values when specifying 'auto' match the default specified values 21 in the UA style sheet. 22 23 Note that additional test coverage exists in the form of web platform 24 web platform tests, and is dependent on unprefixing. 25 26 [1] https://www.w3.org/TR/css-ui-4/#valdef-appearance-auto 27 28 * css/CSSPrimitiveValueMappings.h: 29 (WebCore::CSSPrimitiveValue::CSSPrimitiveValue): 30 (WebCore::CSSPrimitiveValue::operator ControlPart const): 31 * css/CSSProperties.json: 32 * css/parser/CSSParserFastPaths.cpp: 33 (WebCore::CSSParserFastPaths::isValidKeywordPropertyAndValue): 34 * platform/ThemeTypes.cpp: 35 (WebCore::operator<<): 36 * platform/ThemeTypes.h: 37 * rendering/RenderTheme.cpp: 38 (WebCore::RenderTheme::adjustStyle): 39 (WebCore::RenderTheme::autoAppearanceForElement const): 40 * rendering/RenderTheme.h: 41 1 42 2021-10-08 BJ Burg <bburg@apple.com> 2 43 -
trunk/Source/WebCore/css/CSSPrimitiveValueMappings.h
r283279 r283858 424 424 m_value.valueID = CSSValueNone; 425 425 break; 426 case AutoPart: 427 m_value.valueID = CSSValueAuto; 428 break; 426 429 case CheckboxPart: 427 430 m_value.valueID = CSSValueCheckbox; … … 630 633 if (m_value.valueID == CSSValueNone) 631 634 return NoControlPart; 632 return ControlPart(m_value.valueID - CSSValueCheckbox + 1); 635 636 if (m_value.valueID == CSSValueAuto) 637 return AutoPart; 638 639 return ControlPart(m_value.valueID - CSSValueCheckbox + CheckboxPart); 633 640 } 634 641 -
trunk/Source/WebCore/css/CSSProperties.json
r283742 r283858 5004 5004 "color-well", 5005 5005 "list-button", 5006 "auto", 5006 5007 "none" 5007 5008 ], -
trunk/Source/WebCore/css/parser/CSSParserFastPaths.cpp
r283742 r283858 755 755 return valueID == CSSValueVisible || valueID == CSSValueHidden || valueID == CSSValueCollapse; 756 756 case CSSPropertyWebkitAppearance: 757 return (valueID >= CSSValueCheckbox && valueID <= CSSValueCapsLockIndicator) || valueID == CSSValueNone ;757 return (valueID >= CSSValueCheckbox && valueID <= CSSValueCapsLockIndicator) || valueID == CSSValueNone || valueID == CSSValueAuto; 758 758 case CSSPropertyBackfaceVisibility: 759 759 return valueID == CSSValueVisible || valueID == CSSValueHidden; -
trunk/Source/WebCore/platform/ThemeTypes.cpp
r272117 r283858 35 35 switch (controlPart) { 36 36 case NoControlPart: ts << "no-control-part"; break; 37 case AutoPart: ts << "auto-part"; break; 37 38 case CheckboxPart: ts << "checkbox-part"; break; 38 39 case RadioPart: ts << "radio-part"; break; -
trunk/Source/WebCore/platform/ThemeTypes.h
r272117 r283858 35 35 enum ControlPart { 36 36 NoControlPart, 37 AutoPart, 37 38 CheckboxPart, 38 39 RadioPart, -
trunk/Source/WebCore/rendering/RenderTheme.cpp
r283269 r283858 35 35 #include "FrameSelection.h" 36 36 #include "GraphicsContext.h" 37 #include "HTMLAttachmentElement.h" 38 #include "HTMLButtonElement.h" 37 39 #include "HTMLInputElement.h" 38 40 #include "HTMLMeterElement.h" 39 41 #include "HTMLNames.h" 42 #include "HTMLProgressElement.h" 43 #include "HTMLSelectElement.h" 44 #include "HTMLTextAreaElement.h" 40 45 #include "LocalizedStrings.h" 41 46 #include "Page.h" … … 45 50 #include "RenderView.h" 46 51 #include "RuntimeEnabledFeatures.h" 52 #include "ShadowPseudoIds.h" 47 53 #include "SpinButtonElement.h" 48 54 #include "StringTruncator.h" … … 78 84 void RenderTheme::adjustStyle(RenderStyle& style, const Element* element, const RenderStyle* userAgentAppearanceStyle) 79 85 { 86 auto part = style.appearance(); 87 if (part == AutoPart) { 88 part = autoAppearanceForElement(element); 89 if (part == NoControlPart) { 90 style.setEffectiveAppearance(NoControlPart); 91 return; 92 } 93 } 94 80 95 // Force inline and table display styles to be inline-block (except for table- which is block) 81 ControlPart part = style.appearance();82 96 if (style.display() == DisplayType::Inline || style.display() == DisplayType::InlineTable || style.display() == DisplayType::TableRowGroup 83 97 || style.display() == DisplayType::TableHeaderGroup || style.display() == DisplayType::TableFooterGroup … … 91 105 switch (part) { 92 106 case MenulistPart: 93 style.setEffectiveAppearance(MenulistButtonPart);94 107 part = MenulistButtonPart; 95 108 break; 96 109 default: 97 style.setEffectiveAppearance(NoControlPart);110 part = NoControlPart; 98 111 break; 99 112 } 100 113 } 114 115 ASSERT(part != AutoPart); 116 style.setEffectiveAppearance(part); 101 117 102 118 if (!style.hasEffectiveAppearance()) … … 192 208 193 209 // Call the appropriate style adjustment method based off the appearance value. 194 switch ( style.effectiveAppearance()) {210 switch (part) { 195 211 #if !USE(NEW_THEME) 196 212 case CheckboxPart: … … 269 285 break; 270 286 } 287 } 288 289 ControlPart RenderTheme::autoAppearanceForElement(const Element* elementPtr) const 290 { 291 if (!elementPtr) 292 return NoControlPart; 293 294 Ref element = *elementPtr; 295 296 if (is<HTMLInputElement>(element)) { 297 auto& input = downcast<HTMLInputElement>(element.get()); 298 299 if (input.isTextButton() || input.isUploadButton()) 300 return PushButtonPart; 301 302 if (input.isCheckbox()) 303 return CheckboxPart; 304 305 if (input.isRadioButton()) 306 return RadioPart; 307 308 if (input.isSearchField()) 309 return SearchFieldPart; 310 311 if (input.isDateField() || input.isDateTimeLocalField() || input.isMonthField() || input.isTimeField() || input.isWeekField()) { 312 #if PLATFORM(IOS_FAMILY) 313 return MenulistButtonPart; 314 #else 315 return TextFieldPart; 316 #endif 317 } 318 319 #if ENABLE(INPUT_TYPE_COLOR) 320 if (input.isColorControl()) 321 return ColorWellPart; 322 #endif 323 324 if (input.isRangeControl()) 325 return SliderHorizontalPart; 326 327 if (input.isTextField()) 328 return TextFieldPart; 329 330 // <input type=hidden|image|file> 331 return NoControlPart; 332 } 333 334 if (is<HTMLButtonElement>(element)) 335 return ButtonPart; 336 337 if (is<HTMLSelectElement>(element)) { 338 #if PLATFORM(IOS_FAMILY) 339 return MenulistButtonPart; 340 #else 341 auto& select = downcast<HTMLSelectElement>(element.get()); 342 return select.usesMenuList() ? MenulistPart : ListboxPart; 343 #endif 344 } 345 346 if (is<HTMLTextAreaElement>(element)) 347 return TextAreaPart; 348 349 if (is<HTMLMeterElement>(element)) 350 return MeterPart; 351 352 if (is<HTMLProgressElement>(element)) 353 return ProgressBarPart; 354 355 #if ENABLE(ATTACHMENT_ELEMENT) 356 if (is<HTMLAttachmentElement>(element)) 357 return AttachmentPart; 358 #endif 359 360 if (element->isInUserAgentShadowTree()) { 361 auto& pseudo = element->shadowPseudoId(); 362 363 #if ENABLE(DATALIST_ELEMENT) 364 if (pseudo == ShadowPseudoIds::webkitListButton()) 365 return ListButtonPart; 366 #endif 367 368 if (pseudo == ShadowPseudoIds::webkitCapsLockIndicator()) 369 return CapsLockIndicatorPart; 370 371 if (pseudo == ShadowPseudoIds::webkitSearchCancelButton()) 372 return SearchFieldCancelButtonPart; 373 374 if (pseudo == ShadowPseudoIds::webkitSearchDecoration()) 375 return SearchFieldDecorationPart; 376 377 if (pseudo == ShadowPseudoIds::webkitSearchResultsDecoration()) 378 return SearchFieldResultsDecorationPart; 379 380 if (pseudo == ShadowPseudoIds::webkitSearchResultsButton()) 381 return SearchFieldResultsButtonPart; 382 383 if (pseudo == ShadowPseudoIds::webkitSliderThumb() || pseudo == ShadowPseudoIds::webkitMediaSliderThumb()) 384 return SliderThumbHorizontalPart; 385 386 if (pseudo == ShadowPseudoIds::webkitInnerSpinButton()) 387 return InnerSpinButtonPart; 388 } 389 390 return NoControlPart; 271 391 } 272 392 -
trunk/Source/WebCore/rendering/RenderTheme.h
r279002 r283858 455 455 456 456 private: 457 ControlPart autoAppearanceForElement(const Element*) const; 458 457 459 void adjustSearchFieldDecorationStyle(RenderStyle&, const Element*) const; 458 460
Note: See TracChangeset
for help on using the changeset viewer.