Changeset 246193 in webkit
- Timestamp:
- Jun 7, 2019 1:27:25 AM (5 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 23 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r246184 r246193 1 2019-06-07 Joonghun Park <jh718.park@samsung.com> 2 3 Implement tab-size with units 4 https://bugs.webkit.org/show_bug.cgi?id=179022 5 6 Reviewed by Simon Fraser. 7 8 This change is ported from Blink. 9 The committed revision is https://src.chromium.org/viewvc/blink?revision=189430&view=revision. 10 11 Additionally, this patch lets css "number" value be allowed as tab-size's property value, 12 not css "integer" value, 13 according to https://drafts.csswg.org/css-text-3/#tab-size-property. 14 15 * TestExpectations: 16 * css3/tab-size-expected.txt: Added. 17 * css3/tab-size.html: Added. 18 * fast/css/tab-size-expected.html: 19 * fast/css/tab-size.html: 20 1 21 2019-06-06 Youenn Fablet <youenn@apple.com> 2 22 -
trunk/LayoutTests/TestExpectations
r246104 r246193 1822 1822 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-ic-002.html [ ImageOnlyFailure ] 1823 1823 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/line-breaking/line-breaking-ic-003.html [ ImageOnlyFailure ] 1824 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/tab-size/tab-size-length-001.html [ ImageOnlyFailure ]1825 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/tab-size/tab-size-length-002.html [ ImageOnlyFailure ]1826 1824 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-001.html [ ImageOnlyFailure ] 1827 1825 webkit.org/b/183258 imported/w3c/web-platform-tests/css/css-text/text-align/text-align-end-002.html [ ImageOnlyFailure ] … … 1918 1916 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/tab-size/tab-size-spacing-001.html [ ImageOnlyFailure ] 1919 1917 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/tab-size/tab-min-rendered-width-1.html [ ImageOnlyFailure ] 1920 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/tab-size/tab-size-inheritance-001.html [ ImageOnlyFailure ]1921 1918 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/text-indent/text-indent-percentage-002.html [ ImageOnlyFailure ] 1922 1919 webkit.org/b/195275 imported/w3c/web-platform-tests/css/css-text/text-indent/text-indent-percentage-004.html [ ImageOnlyFailure ] -
trunk/LayoutTests/fast/css/tab-size-expected.html
r224193 r246193 30 30 <pre>xxxxxxxxx xx x</pre> 31 31 </div> 32 <b>Tab size = 20px, should not assert, and fall back to 8.</b>33 <div>34 <pre> x</pre>35 <pre> x</pre>36 <pre> x x</pre>37 <pre>xx xx x</pre>38 <pre>xxxxxxxxx xx x</pre>39 </div>40 32 <b>Tab size becomes 2 dynamically.</b> 41 33 <div> -
trunk/LayoutTests/fast/css/tab-size.html
r224193 r246193 26 26 setupBlock("Tab size = -10, should fall back to the default.", "tab-size: -10;"); 27 27 setupBlock("Tab size = 2.", "tab-size: 2;"); 28 setupBlock("Tab size = 20px, should not assert, and fall back to 8.", "tab-size: 20px;");29 28 30 29 var dynamicBlock = setupBlock("Tab size becomes 2 dynamically.", null); -
trunk/LayoutTests/imported/w3c/ChangeLog
r246122 r246193 1 2019-06-07 Joonghun Park <jh718.park@samsung.com> 2 3 Implement tab-size with units 4 https://bugs.webkit.org/show_bug.cgi?id=179022 5 6 Reviewed by Simon Fraser. 7 8 This change is ported from Blink. 9 The committed revision is https://src.chromium.org/viewvc/blink?revision=189430&view=revision. 10 11 Additionally, this patch lets css "number" value be allowed as tab-size's property value, 12 not css "integer" value, 13 according to https://drafts.csswg.org/css-text-3/#tab-size-property. 14 15 * web-platform-tests/css/css-text/inheritance-expected.txt: 16 * web-platform-tests/css/css-text/parsing/tab-size-valid-expected.txt: 17 * web-platform-tests/css/css-values/calc-numbers-expected.txt: Added. 18 * web-platform-tests/css/css-values/calc-numbers.html: Added. 19 1 20 2019-06-05 Antoine Quint <graouts@apple.com> 2 21 -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/inheritance-expected.txt
r242550 r246193 11 11 FAIL Property overflow-wrap inherits assert_equals: expected "break-word" but got "normal" 12 12 PASS Property tab-size has initial value 8 13 FAIL Property tab-size inherits assert_equals: expected "10px" but got "8" 13 PASS Property tab-size inherits 14 14 PASS Property text-align-all has initial value start 15 15 PASS Property text-align-all inherits -
trunk/LayoutTests/imported/w3c/web-platform-tests/css/css-text/parsing/tab-size-valid-expected.txt
r242550 r246193 1 1 2 2 PASS e.style['tab-size'] = "0" should set the property value 3 FAIL e.style['tab-size'] = "2.5" should set the property value assert_not_equals: property should be set got disallowed value "" 4 FAIL e.style['tab-size'] = "0px" should set the property value assert_not_equals: property should be set got disallowed value "" 5 FAIL e.style['tab-size'] = "10px" should set the property value assert_not_equals: property should be set got disallowed value "" 6 FAIL e.style['tab-size'] = "calc(2em + 3ex)" should set the property value assert_not_equals: property should be set got disallowed value "" 3 PASS e.style['tab-size'] = "2.5" should set the property value 4 PASS e.style['tab-size'] = "0px" should set the property value 5 PASS e.style['tab-size'] = "10px" should set the property value 6 PASS e.style['tab-size'] = "calc(2em + 3ex)" should set the property value 7 7 -
trunk/Source/WebCore/ChangeLog
r246192 r246193 1 2019-06-07 Joonghun Park <jh718.park@samsung.com> 2 3 Implement tab-size with units 4 https://bugs.webkit.org/show_bug.cgi?id=179022 5 6 Reviewed by Simon Fraser. 7 8 This change is ported from Blink. 9 The committed revision is https://src.chromium.org/viewvc/blink?revision=189430&view=revision. 10 11 Additionally, this patch lets css "number" value be allowed as tab-size's property value, 12 not css "integer" value, 13 according to https://drafts.csswg.org/css-text-3/#tab-size-property. 14 15 Tests: css3/tab-size.html 16 imported/w3c/web-platform-tests/css/css-values/calc-numbers.html 17 18 * Headers.cmake: 19 * WebCore.xcodeproj/project.pbxproj: 20 * css/CSSComputedStyleDeclaration.cpp: 21 (WebCore::ComputedStyleExtractor::valueForPropertyInStyle): 22 * css/CSSProperties.json: 23 * css/StyleBuilderConverter.h: 24 (WebCore::StyleBuilderConverter::convertTabSize): 25 * css/parser/CSSPropertyParser.cpp: 26 (WebCore::consumeTabSize): 27 * layout/inlineformatting/text/TextUtil.cpp: 28 (WebCore::Layout::TextUtil::width): 29 * platform/graphics/FontCascade.h: 30 (WebCore::FontCascade::tabWidth const): 31 * platform/graphics/TabSize.h: Added. 32 (WebCore::TabSize::TabSize): 33 (WebCore::TabSize::isSpaces const): 34 (WebCore::TabSize::widthInPixels const): 35 (WebCore::TabSize::operator bool const): 36 (WebCore::operator==): 37 (WebCore::operator!=): 38 * platform/graphics/TextRun.cpp: 39 * platform/graphics/TextRun.h: 40 (WebCore::TextRun::tabSize const): 41 (WebCore::TextRun::setTabSize): 42 * rendering/SimpleLineLayoutTextFragmentIterator.cpp: 43 (WebCore::SimpleLineLayout::TextFragmentIterator::Style::Style): 44 * rendering/SimpleLineLayoutTextFragmentIterator.h: 45 * rendering/style/RenderStyle.h: 46 (WebCore::RenderStyle::tabSize const): 47 (WebCore::RenderStyle::setTabSize): 48 (WebCore::RenderStyle::initialTabSize): 49 * rendering/style/StyleRareInheritedData.cpp: 50 * rendering/style/StyleRareInheritedData.h: 51 1 52 2019-06-07 Philippe Normand <pnormand@igalia.com> 2 53 -
trunk/Source/WebCore/Headers.cmake
r245798 r246193 1087 1087 platform/graphics/RoundedRect.h 1088 1088 platform/graphics/StringTruncator.h 1089 platform/graphics/TabSize.h 1089 1090 platform/graphics/TextRun.h 1090 1091 platform/graphics/TiledBacking.h -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r246070 r246193 1022 1022 38F23AB51E8E83D000CE46F5 /* JSWebGPUComputePipelineState.h in Headers */ = {isa = PBXBuildFile; fileRef = 38F23AB21E8E83D000CE46F5 /* JSWebGPUComputePipelineState.h */; }; 1023 1023 3AC648B2129E146500C3EB25 /* EditingBoundary.h in Headers */ = {isa = PBXBuildFile; fileRef = 3AC648B1129E146500C3EB25 /* EditingBoundary.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1024 3BB6B81122A7D313003A2A69 /* TabSize.h in Headers */ = {isa = PBXBuildFile; fileRef = 3BB6B80F22A7D311003A2A69 /* TabSize.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1024 1025 3C244FEAA375AC633F88BE6F /* RenderLayerModelObject.h in Headers */ = {isa = PBXBuildFile; fileRef = 3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1025 1026 3F2B33EF165AF15600E3987C /* JSWebKitCSSViewportRule.h in Headers */ = {isa = PBXBuildFile; fileRef = 3F2B33EA165AF15500E3987C /* JSWebKitCSSViewportRule.h */; }; … … 7166 7167 38F23AB21E8E83D000CE46F5 /* JSWebGPUComputePipelineState.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = JSWebGPUComputePipelineState.h; sourceTree = "<group>"; }; 7167 7168 3AC648B1129E146500C3EB25 /* EditingBoundary.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingBoundary.h; sourceTree = "<group>"; }; 7169 3BB6B80F22A7D311003A2A69 /* TabSize.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TabSize.h; sourceTree = "<group>"; }; 7168 7170 3C244FE4A375AC633F88BE6F /* RenderLayerModelObject.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RenderLayerModelObject.h; sourceTree = "<group>"; }; 7169 7171 3C244FE5A375AC633F88BE6F /* RenderLayerModelObject.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = RenderLayerModelObject.cpp; sourceTree = "<group>"; }; … … 24550 24552 087558C313B4A57D00F49307 /* SurrogatePairAwareTextIterator.cpp */, 24551 24553 087558C413B4A57D00F49307 /* SurrogatePairAwareTextIterator.h */, 24554 3BB6B80F22A7D311003A2A69 /* TabSize.h */, 24552 24555 376DCCE013B4F966002EBEFC /* TextRun.cpp */, 24553 24556 A824B4640E2EF2EA0081A7B7 /* TextRun.h */, … … 31800 31803 5D5975B319635F1100D00878 /* SystemVersion.h in Headers */, 31801 31804 A8CFF0510A154F09000A4234 /* TableLayout.h in Headers */, 31805 3BB6B81122A7D313003A2A69 /* TabSize.h in Headers */, 31802 31806 463EB6231B8789E00096ED51 /* TagCollection.h in Headers */, 31803 31807 F55B3DD61251F12D003EF269 /* TelephoneInputType.h in Headers */, -
trunk/Source/WebCore/css/CSSComputedStyleDeclaration.cpp
r245960 r246193 3027 3027 return zoomAdjustedPixelValue(style.columnWidth(), style); 3028 3028 case CSSPropertyTabSize: 3029 return cssValuePool.createValue(style.tabSize() , CSSPrimitiveValue::CSS_NUMBER);3029 return cssValuePool.createValue(style.tabSize().widthInPixels(1.0), style.tabSize().isSpaces() ? CSSPrimitiveValue::CSS_NUMBER : CSSPrimitiveValue::CSS_PX); 3030 3030 case CSSPropertyCursor: { 3031 3031 RefPtr<CSSValueList> list; -
trunk/Source/WebCore/css/CSSProperties.json
r245838 r246193 3764 3764 "tab-size": { 3765 3765 "inherited": true, 3766 "codegen-properties": { 3767 "converter": "TabSize" 3768 }, 3766 3769 "specification": { 3767 3770 "category": "css-text", 3768 "url": "https:// www.w3.org/TR/css-text-3/#tab-size"3771 "url": "https://drafts.csswg.org/css-text-3/#tab-size-property" 3769 3772 } 3770 3773 }, -
trunk/Source/WebCore/css/StyleBuilderConverter.h
r245798 r246193 54 54 #include "StyleResolver.h" 55 55 #include "StyleScrollSnapPoints.h" 56 #include "TabSize.h" 56 57 #include "TouchAction.h" 57 58 #include "TransformFunctions.h" … … 67 68 static Length convertLengthSizing(const StyleResolver&, const CSSValue&); 68 69 static Length convertLengthMaxSizing(const StyleResolver&, const CSSValue&); 70 static TabSize convertTabSize(const StyleResolver&, const CSSValue&); 69 71 template<typename T> static T convertComputedLength(StyleResolver&, const CSSValue&); 70 72 template<typename T> static T convertLineWidth(StyleResolver&, const CSSValue&); … … 256 258 } 257 259 260 inline TabSize StyleBuilderConverter::convertTabSize(const StyleResolver& styleResolver, const CSSValue& value) 261 { 262 auto& primitiveValue = downcast<CSSPrimitiveValue>(value); 263 if (primitiveValue.isNumber()) 264 return TabSize(primitiveValue.floatValue(), SpaceValueType); 265 return TabSize(primitiveValue.computeLength<float>(styleResolver.state().cssToLengthConversionData()), LengthValueType); 266 } 267 258 268 template<typename T> 259 269 inline T StyleBuilderConverter::convertComputedLength(StyleResolver& styleResolver, const CSSValue& value) -
trunk/Source/WebCore/css/parser/CSSPropertyParser.cpp
r245798 r246193 1122 1122 } 1123 1123 1124 static RefPtr<CSSValue> consumeTabSize(CSSParserTokenRange& range, CSSParserMode) 1125 { 1126 return consumeInteger(range, 0); 1124 static RefPtr<CSSValue> consumeTabSize(CSSParserTokenRange& range, CSSParserMode cssParserMode) 1125 { 1126 auto tabSize = consumeNumber(range, ValueRangeNonNegative); 1127 if (tabSize) 1128 return tabSize; 1129 return consumeLength(range, cssParserMode, ValueRangeNonNegative); 1127 1130 } 1128 1131 -
trunk/Source/WebCore/layout/inlineformatting/text/TextUtil.cpp
r245850 r246193 58 58 ++to; 59 59 LayoutUnit width; 60 auto tabWidth = style.collapseWhiteSpace() ? 0: style.tabSize();60 auto tabWidth = style.collapseWhiteSpace() ? TabSize(0) : style.tabSize(); 61 61 62 62 WebCore::TextRun run(StringView(text).substring(from, to - from), contentLogicalLeft); -
trunk/Source/WebCore/platform/graphics/FontCascade.h
r239427 r246193 150 150 const FontMetrics& fontMetrics() const { return primaryFont().fontMetrics(); } 151 151 float spaceWidth() const { return primaryFont().spaceWidth() + m_letterSpacing; } 152 float tabWidth(const Font&, unsigned tabSize, float position) const;153 float tabWidth( unsignedtabSize, float position) const { return tabWidth(primaryFont(), tabSize, position); }152 float tabWidth(const Font&, const TabSize&, float) const; 153 float tabWidth(const TabSize& tabSize, float position) const { return tabWidth(primaryFont(), tabSize, position); } 154 154 bool hasValidAverageCharWidth() const; 155 155 bool fastAverageCharWidthIfAvailable(float &width) const; // returns true on success … … 355 355 } 356 356 357 inline float FontCascade::tabWidth(const Font& font, unsigned tabSize, float position) const 358 { 359 if (!tabSize) 357 inline float FontCascade::tabWidth(const Font& font, const TabSize& tabSize, float position) const 358 { 359 float baseTabWidth = tabSize.widthInPixels(font.spaceWidth()); 360 if (!baseTabWidth) 360 361 return letterSpacing(); 361 float tabWidth = tabSize * font.spaceWidth() + letterSpacing(); 362 float tabDeltaWidth = tabWidth - fmodf(position, tabWidth); 363 return (tabDeltaWidth < font.spaceWidth() / 2) ? tabWidth : tabDeltaWidth; 364 } 365 366 } 362 float tabDeltaWidth = baseTabWidth - fmodf(position, baseTabWidth); 363 return (tabDeltaWidth < font.spaceWidth() / 2) ? baseTabWidth : tabDeltaWidth; 364 } 365 366 } -
trunk/Source/WebCore/platform/graphics/TextRun.cpp
r230452 r246193 31 31 struct ExpectedTextRunSize { 32 32 String text; 33 unsigned integer1;33 TabSize tabSize; 34 34 float float1; 35 35 float float2; -
trunk/Source/WebCore/platform/graphics/TextRun.h
r237845 r246193 25 25 #define TextRun_h 26 26 27 #include "TabSize.h" 27 28 #include "TextFlags.h" 28 29 #include "WritingMode.h" … … 96 97 97 98 bool allowTabs() const { return m_allowTabs; } 98 unsignedtabSize() const { return m_tabSize; }99 void setTabSize(bool, unsigned);99 const TabSize& tabSize() const { return m_tabSize; } 100 void setTabSize(bool, const TabSize&); 100 101 101 102 float xPos() const { return m_xpos; } … … 119 120 String m_text; 120 121 121 unsignedm_tabSize;122 TabSize m_tabSize; 122 123 123 124 // m_xpos is the x position relative to the left start of the text line, not relative to the left … … 137 138 }; 138 139 139 inline void TextRun::setTabSize(bool allow, unsignedsize)140 inline void TextRun::setTabSize(bool allow, const TabSize& size) 140 141 { 141 142 m_allowTabs = allow; -
trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.cpp
r244036 r246193 50 50 , keepAllWordsForCJK(style.wordBreak() == WordBreak::KeepAll) 51 51 , wordSpacing(font.wordSpacing()) 52 , tabWidth(collapseWhitespace ? 0: style.tabSize())52 , tabWidth(collapseWhitespace ? TabSize(0) : style.tabSize()) 53 53 , shouldHyphenate(style.hyphens() == Hyphens::Auto && canHyphenate(style.locale())) 54 54 , hyphenStringWidth(shouldHyphenate ? font.width(TextRun(String(style.hyphenString()))) : 0) -
trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h
r244036 r246193 119 119 bool keepAllWordsForCJK; 120 120 float wordSpacing; 121 unsignedtabWidth;121 TabSize tabWidth; 122 122 bool shouldHyphenate; 123 123 float hyphenStringWidth; -
trunk/Source/WebCore/rendering/style/RenderStyle.h
r245838 r246193 662 662 bool hasTextCombine() const { return textCombine() != TextCombine::None; } 663 663 664 unsignedtabSize() const { return m_rareInheritedData->tabSize; }664 const TabSize& tabSize() const { return m_rareInheritedData->tabSize; } 665 665 666 666 // End CSS3 Getters … … 1191 1191 #endif 1192 1192 1193 void setTabSize( unsignedsize) { SET_VAR(m_rareInheritedData, tabSize, size); }1193 void setTabSize(TabSize size) { SET_VAR(m_rareInheritedData, tabSize, size); } 1194 1194 1195 1195 void setBreakBefore(BreakBetween breakBehavior) { SET_VAR(m_rareNonInheritedData, breakBefore, static_cast<unsigned>(breakBehavior)); } … … 1673 1673 static GridPosition initialGridItemRowEnd() { return GridPosition(); } 1674 1674 1675 static unsignedinitialTabSize() { return 8; }1675 static TabSize initialTabSize() { return 8; } 1676 1676 1677 1677 static const AtomicString& initialLineGrid() { return nullAtom(); } -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.cpp
r244408 r246193 51 51 unsigned bitfields[4]; 52 52 short pagedMediaShorts[2]; 53 unsigned unsigneds[1];53 TabSize tabSize; 54 54 short hyphenationShorts[3]; 55 55 -
trunk/Source/WebCore/rendering/style/StyleRareInheritedData.h
r244408 r246193 29 29 #include "Length.h" 30 30 #include "StyleCustomPropertyData.h" 31 #include "TabSize.h" 31 32 #include "TextDecorationThickness.h" 32 33 #include "TextUnderlineOffset.h" … … 173 174 174 175 AtomicString lineGrid; 175 unsignedtabSize;176 TabSize tabSize; 176 177 177 178 #if ENABLE(TEXT_AUTOSIZING)
Note: See TracChangeset
for help on using the changeset viewer.