Commit 4132693e authored by joone.hur@intel.com's avatar joone.hur@intel.com

Quirksmode: CSS1: WebKit fails dynamic :first-letter test

https://bugs.webkit.org/show_bug.cgi?id=15602

Reviewed by David Hyatt.

Source/WebCore:

CSS first-letter property does not work properly when the first letter is changed
by DOM scripting.
This patch allows to check if the existing first-letter is no longer the
first-letter. In this case, it deletes the old first-letter object and creates
a new one. For the remaining text, the oldRemainingText object is used
again for containing the full text(first letter + remaining text).

Test: fast/css/first-letter-block-change.html

* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::updateFirstLetter):

LayoutTests:

Add a test case that ensures that CSS first-letter property should work
properly when the first letter is changed by DOM scripting.

* fast/css/first-letter-block-change.html: Added.
* platform/efl/TestExpectations:
* platform/gtk-wk1/fast/css/first-letter-block-change-expected.png: Added.
* platform/gtk-wk2/fast/css/first-letter-block-change-expected.png: Added.
* platform/gtk/fast/css/first-letter-block-change-expected.txt: Added.
* platform/mac/TestExpectations:


git-svn-id: http://svn.webkit.org/repository/webkit/trunk@156742 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9654c28f
2013-10-01 Joone Hur <joone.hur@intel.com>
Quirksmode: CSS1: WebKit fails dynamic :first-letter test
https://bugs.webkit.org/show_bug.cgi?id=15602
Reviewed by David Hyatt.
Add a test case that ensures that CSS first-letter property should work
properly when the first letter is changed by DOM scripting.
* fast/css/first-letter-block-change.html: Added.
* platform/efl/TestExpectations:
* platform/gtk-wk1/fast/css/first-letter-block-change-expected.png: Added.
* platform/gtk-wk2/fast/css/first-letter-block-change-expected.png: Added.
* platform/gtk/fast/css/first-letter-block-change-expected.txt: Added.
* platform/mac/TestExpectations:
2013-10-01 Brent Fulgham <bfulgham@apple.com>
[Win] Unreviewed gardening.
<!doctype html>
<html>
<head>
<title>Test for first-letter that is added by DOM scripting</title>
<style type="text/css">
p:first-letter {text-decoration: underline; color: #CB000F;}
</style>
<script type="text/javascript">
if (window.testRunner)
testRunner.waitUntilDone();
window.onload = function() {
document.body.offsetTop;
addTextNode();
};
function addTextNode() {
var textNode = document.createTextNode('I am adding a new text. ');
var para = document.getElementById('test');
para.insertBefore(textNode, para.firstChild);
if (window.testRunner)
testRunner.notifyDone();
}
</script>
</head>
<body>
<p id="test">
This is a test paragraph. You can insert extra text at its start;
the :first-letter styles should be updated to accomodate this new text.
</p>
</body>
</html>
......@@ -1655,3 +1655,5 @@ webkit.org/b/118378 vibration/cancelVibration-after-pagevisibility-changed-to-hi
webkit.org/b/119782 fast/forms/search-styled.html [ Failure ]
# This test case needs to be rebaselined.
webkit.org/b/15602 fast/css/first-letter-block-change.html [ Failure ]
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x66
RenderBlock {HTML} at (0,0) size 800x66
RenderBody {BODY} at (8,16) size 784x34
RenderBlock {P} at (0,0) size 784x34
RenderInline (generated) at (0,0) size 5x17 [color=#CB000F]
RenderText {#text} at (0,0) size 5x17
text run at (0,0) width 5: "I"
RenderText {#text} at (5,0) size 147x17
text run at (5,0) width 147: " am adding a new text. "
RenderText {#text} at (152,0) size 775x34
text run at (152,0) width 378: "This is a test paragraph. You can insert extra text at its start; "
text run at (530,0) width 245: "the :first-letter styles should be updated"
text run at (0,17) width 179: "to accomodate this new text."
......@@ -1363,3 +1363,6 @@ webkit.org/b/122039 media/track/track-cue-overlap-snap-to-lines-not-set.html [ P
webkit.org/b/122040 animations/combo-transform-translate+scale.html [ Pass Failure ]
webkit.org/b/122042 media/media-controller-playback.html [ Pass Failure ]
# This test case needs to be rebaselined.
webkit.org/b/15602 fast/css/first-letter-block-change.html [ Failure ]
2013-10-01 Joone Hur <joone.hur@intel.com>
Quirksmode: CSS1: WebKit fails dynamic :first-letter test
https://bugs.webkit.org/show_bug.cgi?id=15602
Reviewed by David Hyatt.
CSS first-letter property does not work properly when the first letter is changed
by DOM scripting.
This patch allows to check if the existing first-letter is no longer the
first-letter. In this case, it deletes the old first-letter object and creates
a new one. For the remaining text, the oldRemainingText object is used
again for containing the full text(first letter + remaining text).
Test: fast/css/first-letter-block-change.html
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::updateFirstLetter):
2013-10-01 Antti Koivisto <antti@apple.com>
Make tests for renderer base types non-virtual
......@@ -5954,8 +5954,6 @@ void RenderBlock::updateFirstLetter()
if (style()->styleType() == FIRST_LETTER)
return;
// FIXME: We need to destroy the first-letter object if it is no longer the first child. Need to find
// an efficient way to check for that situation though before implementing anything.
RenderElement* firstLetterBlock = findFirstLetterBlock(this);
if (!firstLetterBlock)
return;
......@@ -5987,9 +5985,24 @@ void RenderBlock::updateFirstLetter()
if (!descendant)
return;
// If the child already has style, then it has already been created, so we just want
// to update it.
if (descendant->parent()->style()->styleType() == FIRST_LETTER) {
// Destroy the first-letter object if it is no longer the first child.
RenderObject* remainingText = descendant->parent()->nextSibling();
if (remainingText && descendant->node() != remainingText->node()) {
if (!remainingText->isText() || remainingText->isBR())
return;
LayoutStateDisabler layoutStateDisabler(&view());
if (RenderObject* oldRemainingText = toRenderBoxModelObject(descendant->parent())->firstLetterRemainingText())
toRenderText(oldRemainingText)->setText(toText(oldRemainingText->node())->data().impl());
createFirstLetterRenderer(firstLetterBlock, toRenderText(remainingText));
return;
}
// If the child already has style, then it has already been created, so we just want
// to update it.
updateFirstLetterStyle(firstLetterBlock, descendant);
return;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment