Changeset 116438 in webkit
- Timestamp:
- May 8, 2012 11:25:19 AM (12 years ago)
- Location:
- trunk
- Files:
-
- 67 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r116435 r116438 1 2012-03-31 Robert Hogan <robert@webkit.org> 2 3 CSS 2.1 failure: first-letter-nested-004.htm fails 4 https://bugs.webkit.org/show_bug.cgi?id=72987 5 6 Reviewed by Eric Seidel. 7 8 * css2.1/20110323/first-letter-000.htm: Added. 9 * css2.1/20110323/first-letter-001.htm: Added. 10 * css2.1/20110323/first-letter-dynamic-001.htm: Added. 11 * css2.1/20110323/first-letter-dynamic-002.htm: Added. 12 * css2.1/20110323/first-letter-dynamic-003a.htm: Added. 13 * css2.1/20110323/first-letter-dynamic-003b.htm: Added. 14 * css2.1/20110323/first-letter-inherit-001.htm: Added. 15 * css2.1/20110323/first-letter-nested-001.htm: Added. 16 * css2.1/20110323/first-letter-nested-002.htm: Added. 17 * css2.1/20110323/first-letter-nested-003.htm: Added. 18 * css2.1/20110323/first-letter-nested-004.htm: Added. 19 * css2.1/20110323/first-letter-nested-005.htm: Added. 20 * css2.1/20110323/first-letter-nested-006.htm: Added. 21 * css2.1/20110323/first-letter-nested-007.htm: Added. 22 * css2.1/20110323/first-letter-quote-001.htm: Added. 23 * css2.1/20110323/first-letter-quote-002.htm: Added. 24 * css2.1/20110323/first-letter-quote-003.htm: Added. 25 * css2.1/20110323/first-letter-quote-004.htm: Added. 26 * css2.1/20110323/first-letter-quote-005.htm: Added. 27 * css2.1/20110323/first-letter-quote-006.htm: Added. 28 * fast/css/first-letter-capitalized-edit-select-crash-expected.txt: 29 Rebaselined. 30 * fast/css/first-letter-nested-positioned.htm: Added. 31 Tests that text nested inside a positioned object is styled. 32 * fast/css/first-letter-quotes-no-content-before-after.html: Added. 33 Tests that two consecutive quotes, each in a :before and :after pseudo element surrounding 34 an empty main element, get styled with first letter. 35 36 Behold! Pixel Results! 37 38 * platform/chromium-linux-x86/css2.1/20110323/first-letter-000-expected.png: Added. 39 * platform/chromium-linux-x86/css2.1/20110323/first-letter-000-expected.txt: Added. 40 * platform/chromium-linux-x86/css2.1/20110323/first-letter-001-expected.png: Added. 41 * platform/chromium-linux-x86/css2.1/20110323/first-letter-001-expected.txt: Added. 42 * platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-001-expected.png: Added. 43 * platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-001-expected.txt: Added. 44 * platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-002-expected.png: Added. 45 * platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-002-expected.txt: Added. 46 * platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003a-expected.png: Added. 47 * platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003a-expected.txt: Added. 48 * platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003b-expected.png: Added. 49 * platform/chromium-linux-x86/css2.1/20110323/first-letter-dynamic-003b-expected.txt: Added. 50 * platform/chromium-linux-x86/css2.1/20110323/first-letter-inherit-001-expected.png: Added. 51 * platform/chromium-linux-x86/css2.1/20110323/first-letter-inherit-001-expected.txt: Added. 52 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-001-expected.png: Added. 53 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-001-expected.txt: Added. 54 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-002-expected.png: Added. 55 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-002-expected.txt: Added. 56 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-003-expected.png: Added. 57 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-003-expected.txt: Added. 58 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-004-expected.png: Added. 59 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-004-expected.txt: Added. 60 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-005-expected.png: Added. 61 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-005-expected.txt: Added. 62 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-006-expected.png: Added. 63 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-006-expected.txt: Added. 64 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-007-expected.png: Added. 65 * platform/chromium-linux-x86/css2.1/20110323/first-letter-nested-007-expected.txt: Added. 66 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-001-expected.png: Added. 67 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-001-expected.txt: Added. 68 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-002-expected.png: Added. 69 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-002-expected.txt: Added. 70 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-003-expected.png: Added. 71 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-003-expected.txt: Added. 72 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-004-expected.png: Added. 73 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-004-expected.txt: Added. 74 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-005-expected.png: Added. 75 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-005-expected.txt: Added. 76 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-006-expected.png: Added. 77 * platform/chromium-linux-x86/css2.1/20110323/first-letter-quote-006-expected.txt: Added. 78 * platform/chromium-linux-x86/fast/css/first-letter-nested-positioned-expected.png: Added. 79 * platform/chromium-linux-x86/fast/css/first-letter-nested-positioned-expected.txt: Added. 80 * platform/chromium-linux-x86/fast/css/first-letter-quotes-no-content-before-after-expected.png: Added. 81 * platform/chromium-linux-x86/fast/css/first-letter-quotes-no-content-before-after-expected.txt: Added. 82 1 83 2012-05-08 Hironori Bono <hbono@chromium.org> 2 84 -
trunk/LayoutTests/fast/css/first-letter-capitalized-edit-select-crash-expected.txt
r112200 r116438 1 1 Pass if no crash or assert in debug 2 2 3 3 -
trunk/Source/WebCore/ChangeLog
r116437 r116438 1 2012-03-31 Robert Hogan <robert@webkit.org> 2 3 CSS 2.1 failure: first-letter-nested-004.htm fails 4 https://bugs.webkit.org/show_bug.cgi?id=72987 5 6 Reviewed by Eric Seidel. 7 8 When styling first-letter check each sibling and drill into its inlines until we find either (i) a text node 9 that is not all whitespace, or (ii) a line break. 10 11 This makes our rendering of the following tests compatible with FF and Opera. Our current behaviour is also conformant 12 since the spec allows UAs to style just one element: 13 css2.1/20110323/first-letter-quote-002.htm 14 css2.1/20110323/first-letter-quote-003.htm 15 css2.1/20110323/first-letter-quote-004.htm 16 css2.1/20110323/first-letter-quote-005.htm 17 18 This fixes the following two tests. We now drill into the descendants of an element styled with :first-letter looking 19 for text to style: 20 css2.1/20110323/first-letter-nested-004.htm 21 css2.1/20110323/first-letter-nested-006.htm 22 23 This patch changes our rendering of first-letter-dynamic-001.htm as we now render adjacent quotes in the second line as 24 green. This is consistent with the spec, which allows this behaviour but does not require it. It's the 'right' behaviour 25 since it is consistent with the rendering of such quotes in a single element with :first-letter style. 26 27 * rendering/RenderBlock.cpp: 28 (WebCore::RenderBlock::findLastObjectWithFirstLetterText): Iterate through the child's siblings looking for the last 29 object to be styled :first-letter. 30 (WebCore::RenderBlock::findLastObjectAfterFirstLetterPunctuation): Style any leading punctuation as first-letter, drill 31 down into the child's descendants looking for text if necessary. 32 (WebCore::RenderBlock::updateFirstLetter): Refactor to drill into sibling's children looking for inlines 33 that should be styled as first-letter. 34 (WebCore::RenderBlock::addFirstLetter): Split out from updateFirstLetter so that it can be used when a 35 descendant node inside a sibling is found in findLastObjectWithFirstLetterText() needs to be styled as first-letter. 36 * rendering/RenderBlock.h: 37 1 38 2012-05-08 Sheriff Bot <webkit.review.bot@gmail.com> 2 39 -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r116392 r116438 5891 5891 } 5892 5892 5893 RenderObject* RenderBlock::findLastObjectWithFirstLetterText(RenderObject* child, RenderObject* &firstLetterBlock) 5894 { 5895 while (child) { 5896 RenderObject* nextChild = child->nextSibling(); 5897 // Style and skip over any objects such as quotes or punctuation 5898 child = findLastObjectAfterFirstLetterPunctuation(child, firstLetterBlock); 5899 if (child) 5900 break; 5901 child = nextChild; 5902 } 5903 return child; 5904 } 5905 5906 RenderObject* RenderBlock::findLastObjectAfterFirstLetterPunctuation(RenderObject* child, RenderObject* &firstLetterBlock) 5907 { 5908 if (child->isText()) { 5909 // CSS 2.1 http://www.w3.org/TR/CSS21/selector.html#first-letter 5910 // "The first letter must occur on the first formatted line." 5911 if (child->isBR()) 5912 return child; 5913 5914 // If child is a single punctuation mark or a Render Quote then style it as first-letter now and keep looking for further text, 5915 bool textQuote = toRenderText(child)->textLength() == 1 && isPunctuationForFirstLetter(toRenderText(child)->characters()[0]); 5916 if (child->isQuote() || textQuote) 5917 addFirstLetter(child, firstLetterBlock); 5918 else if (!toRenderText(child)->isAllCollapsibleWhitespace()) 5919 return child; 5920 return 0; 5921 } 5922 5923 if (child->isListMarker()) 5924 return 0; 5925 5926 if (child->isFloatingOrPositioned()) { 5927 // Floats and positioned objects do not inherit their style from parents so if it is styled 5928 // inspect its children for text, otherwise move on to its sibling. 5929 if (child->style()->styleType() == FIRST_LETTER) 5930 return findLastObjectWithFirstLetterText(child->firstChild(), firstLetterBlock); 5931 return 0; 5932 } 5933 5934 if (child->isReplaced() || child->isRenderButton() || child->isMenuList()) 5935 return child; 5936 5937 if (child->style()->hasPseudoStyle(FIRST_LETTER) && child->canHaveChildren()) { 5938 // We found a lower-level node with first-letter, which supersedes the higher-level style. 5939 firstLetterBlock = child; 5940 return findLastObjectWithFirstLetterText(child->firstChild(), firstLetterBlock); 5941 } 5942 return findLastObjectWithFirstLetterText(child->firstChild(), firstLetterBlock); 5943 } 5944 5893 5945 static inline RenderObject* findFirstLetterBlock(RenderBlock* start) 5894 5946 { … … 6040 6092 return; 6041 6093 6042 // Drill into inlines looking for our first text child. 6043 RenderObject* currChild = firstLetterBlock->firstChild(); 6044 while (currChild) { 6045 if (currChild->isText()) 6046 break; 6047 if (currChild->isListMarker()) 6048 currChild = currChild->nextSibling(); 6049 else if (currChild->isFloatingOrPositioned()) { 6050 if (currChild->style()->styleType() == FIRST_LETTER) { 6051 currChild = currChild->firstChild(); 6052 break; 6053 } 6054 currChild = currChild->nextSibling(); 6055 } else if (currChild->isReplaced() || currChild->isRenderButton() || currChild->isMenuList()) 6056 break; 6057 else if (currChild->style()->hasPseudoStyle(FIRST_LETTER) && canHaveGeneratedChildren(currChild)) { 6058 // We found a lower-level node with first-letter, which supersedes the higher-level style 6059 firstLetterBlock = currChild; 6060 currChild = currChild->firstChild(); 6061 } else 6062 currChild = currChild->firstChild(); 6063 } 6064 6065 if (!currChild) 6094 // Check each sibling and drill into its inlines until we find a text node that is not all whitespace 6095 // or is a line break. 6096 RenderObject* firstLetterObject = firstLetterBlock->firstChild(); 6097 6098 firstLetterObject = findLastObjectWithFirstLetterText(firstLetterObject, firstLetterBlock); 6099 6100 if (!firstLetterObject) 6066 6101 return; 6102 6103 addFirstLetter(firstLetterObject, firstLetterBlock); 6104 } 6105 6106 void RenderBlock::addFirstLetter(RenderObject* firstLetterObject, RenderObject* &firstLetterBlock) 6107 { 6067 6108 6068 6109 // If the child already has style, then it has already been created, so we just want 6069 6110 // to update it. 6070 if ( currChild->parent()->style()->styleType() == FIRST_LETTER) {6071 updateFirstLetterStyle(firstLetterBlock, currChild);6111 if (firstLetterObject->parent()->style()->styleType() == FIRST_LETTER) { 6112 updateFirstLetterStyle(firstLetterBlock, firstLetterObject); 6072 6113 return; 6073 6114 } 6074 6115 6075 if (! currChild->isText() || currChild->isBR())6116 if (!firstLetterObject->isText() || firstLetterObject->isBR()) 6076 6117 return; 6077 6118 … … 6080 6121 LayoutStateDisabler layoutStateDisabler(view()); 6081 6122 6082 createFirstLetterRenderer(firstLetterBlock, currChild);6123 createFirstLetterRenderer(firstLetterBlock, firstLetterObject); 6083 6124 } 6084 6125 -
trunk/Source/WebCore/rendering/RenderBlock.h
r116392 r116438 506 506 void createFirstLetterRenderer(RenderObject* firstLetterBlock, RenderObject* currentChild); 507 507 void updateFirstLetterStyle(RenderObject* firstLetterBlock, RenderObject* firstLetterContainer); 508 RenderObject* findLastObjectWithFirstLetterText(RenderObject* child, RenderObject* &firstLetterBlock); 509 RenderObject* findLastObjectAfterFirstLetterPunctuation(RenderObject* child, RenderObject* &firstLetterBlock); 510 void addFirstLetter(RenderObject* firstLetterObject, RenderObject* &firstLetterBlock); 508 511 509 512 struct FloatWithRect {
Note: See TracChangeset
for help on using the changeset viewer.