Commit c4262c9c authored by weinig's avatar weinig

LayoutTests:

        Reviewed by Hyatt.

        Test cases for:
        http://bugs.webkit.org/show_bug.cgi?id=4104
        first-letter not updating style with hover
        http://bugs.webkit.org/show_bug.cgi?id=13169
        css-formatted first letter won't hide dynamically

        * fast/css/first-letter-hover-expected.checksum: Added.
        * fast/css/first-letter-hover-expected.png: Added.
        * fast/css/first-letter-hover-expected.txt: Added.
        * fast/css/first-letter-hover.html: Added.
        * fast/css/first-letter-visibility-expected.checksum: Added.
        * fast/css/first-letter-visibility-expected.png: Added.
        * fast/css/first-letter-visibility-expected.txt: Added.
        * fast/css/first-letter-visibility.html: Added.

WebCore:

        Reviewed by Hyatt.

        http://bugs.webkit.org/show_bug.cgi?id=4104
        first-letter not updating style with hover
        http://bugs.webkit.org/show_bug.cgi?id=13169
        css-formatted first letter won't hide dynamically

        Update first letter when RenderBlock::setStyle is called. 

        * css/cssstyleselector.cpp:
        (WebCore::CSSStyleSelector::checkOneSelector):
        * dom/Document.cpp:
        (WebCore::Document::Document):
        (WebCore::Document::createElement):
        * dom/Document.h:
        (WebCore::Document::usesFirstLetterRules):
        (WebCore::Document::setUsesFirstLetterRules):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::setStyle):
        (WebCore::RenderBlock::updateFirstLetter):



git-svn-id: http://svn.webkit.org/repository/webkit/trunk@21742 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 53d51520
2007-05-24 Rob Buis <buis@kde.org>
Reviewed by Hyatt.
Test cases for:
http://bugs.webkit.org/show_bug.cgi?id=4104
first-letter not updating style with hover
http://bugs.webkit.org/show_bug.cgi?id=13169
css-formatted first letter won't hide dynamically
* fast/css/first-letter-hover-expected.checksum: Added.
* fast/css/first-letter-hover-expected.png: Added.
* fast/css/first-letter-hover-expected.txt: Added.
* fast/css/first-letter-hover.html: Added.
* fast/css/first-letter-visibility-expected.checksum: Added.
* fast/css/first-letter-visibility-expected.png: Added.
* fast/css/first-letter-visibility-expected.txt: Added.
* fast/css/first-letter-visibility.html: Added.
2007-05-24 Mitz Pettel <mitz@webkit.org>
Reviewed by Darin.
54617270d74a134e5c3ce9d4a39225a3
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 53x18
text run at (0,0) width 53: "Test for "
RenderInline {A} at (0,0) size 295x18 [color=#0000EE]
RenderText {#text} at (53,0) size 295x18
text run at (53,0) width 295: "http://bugs.webkit.org/show_bug.cgi?id=4104 "
RenderText {#text} at (348,0) size 248x18
text run at (348,0) width 248: "first-letter not updating style with hover"
RenderBlock {P} at (0,34) size 784x18
RenderText {#text} at (0,0) size 391x18
text run at (0,0) width 391: "The next line of text should turn green when we hover over it."
RenderBlock {DIV} at (0,68) size 784x36 [color=#008000]
RenderInline (generated) at (0,0) size 10x18 [color=#0000FF]
RenderText {#text} at (0,0) size 10x18
text run at (0,0) width 10: "T"
RenderText {#text} at (10,0) size 775x36
text run at (10,0) width 765: "he first letter of this paragraph should be larger than the rest. If you hover over this paragraph, all of the text (including the"
text run at (0,18) width 501: "first letter) should turn green. If the first letter remains black, then there is a bug!"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<style type="text/css">
#target:first-letter { color: blue; }
#target:hover { color:green; }
</style>
<script type="text/javascript">
function test()
{
if (!window.eventSender)
return;
document.body.offsetTop; // Force layout. The mouse is not tracked before first layout.
eventSender.mouseMoveTo(60, 95); // Hover.
document.body.offsetTop; // Update layout for hovered state.
}
</script>
</head>
<body onload="test()">
<p>
Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=4104">
http://bugs.webkit.org/show_bug.cgi?id=4104
</a>
first-letter not updating style with hover
</p>
<p>
The next line of text should turn green when we hover over it.
</p>
<div id="target">The first letter of this paragraph should be larger than the rest. If you hover over this paragraph, all of the text (including the first letter) should turn green. If the first letter remains black, then there is a
bug!
</div>
</body>
</html>
40cf7041b67baca368d9eab7e0c1b1b3
\ No newline at end of file
layer at (0,0) size 800x600
RenderView at (0,0) size 800x600
layer at (0,0) size 800x600
RenderBlock {HTML} at (0,0) size 800x600
RenderBody {BODY} at (8,8) size 784x584
RenderBlock {P} at (0,0) size 784x18
RenderText {#text} at (0,0) size 53x18
text run at (0,0) width 53: "Test for "
RenderInline {A} at (0,0) size 303x18 [color=#0000EE]
RenderText {#text} at (53,0) size 303x18
text run at (53,0) width 303: "http://bugs.webkit.org/show_bug.cgi?id=13169 "
RenderText {#text} at (356,0) size 298x18
text run at (356,0) width 298: "css-formatted first letter won't hide dynamically"
RenderBlock {P} at (0,34) size 784x18
RenderText {#text} at (0,0) size 417x18
text run at (0,0) width 417: "The next line of text should become invisible, including first letter."
RenderBlock {DIV} at (0,68) size 784x18
RenderInline (generated) at (0,0) size 11x18 [color=#0000FF]
RenderText {#text} at (0,0) size 11x18
text run at (0,0) width 11: "C"
RenderText {#text} at (11,0) size 70x18
text run at (11,0) width 70: "lick to hide"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title></title>
<style type="text/css">
#target:first-letter { color: blue; }
</style>
<script type="text/javascript">
function test()
{
var target = document.getElementById("target");
target.style.visibility='hidden';
}
</script>
</head>
<body onload="test()">
<p>
Test for <a href="http://bugs.webkit.org/show_bug.cgi?id=13169">
http://bugs.webkit.org/show_bug.cgi?id=13169
</a>
css-formatted first letter won't hide dynamically
</p>
<p>
The next line of text should become invisible, including first letter.
</p>
<div id="target">Click to hide</div>
</body>
</html>
2007-05-24 Rob Buis <buis@kde.org>
Reviewed by Hyatt.
http://bugs.webkit.org/show_bug.cgi?id=4104
first-letter not updating style with hover
http://bugs.webkit.org/show_bug.cgi?id=13169
css-formatted first letter won't hide dynamically
Update first letter when RenderBlock::setStyle is called.
* css/cssstyleselector.cpp:
(WebCore::CSSStyleSelector::checkOneSelector):
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::createElement):
* dom/Document.h:
(WebCore::Document::usesFirstLetterRules):
(WebCore::Document::setUsesFirstLetterRules):
* rendering/RenderBlock.cpp:
(WebCore::RenderBlock::setStyle):
(WebCore::RenderBlock::updateFirstLetter):
2007-05-24 Mitz Pettel <mitz@webkit.org>
Reviewed by Darin.
......@@ -1586,6 +1586,8 @@ bool CSSStyleSelector::checkOneSelector(CSSSelector* sel, Element* e, bool isSub
case CSSSelector::PseudoFirstLetter:
if (subject) {
dynamicPseudo = RenderStyle::FIRST_LETTER;
if (Document* doc = e->document())
doc->setUsesFirstLetterRules(true);
return true;
}
break;
......
......@@ -306,6 +306,7 @@ Document::Document(DOMImplementation* impl, Frame* frame)
m_usesDescendantRules = false;
m_usesSiblingRules = false;
m_usesFirstLineRules = false;
m_usesFirstLetterRules = false;
m_styleSelector = new CSSStyleSelector(this, m_usersheet, m_styleSheets.get(), !inCompatMode());
m_didCalculateStyleSelector = false;
......
......@@ -288,6 +288,8 @@ public:
void setUsesSiblingRules(bool b) { m_usesSiblingRules = b; }
bool usesFirstLineRules() const { return m_usesFirstLineRules; }
void setUsesFirstLineRules(bool b) { m_usesFirstLineRules = b; }
bool usesFirstLetterRules() const { return m_usesFirstLetterRules; }
void setUsesFirstLetterRules(bool b) { m_usesFirstLetterRules = b; }
// Machinery for saving and restoring state when you leave and then go back to a page.
void registerFormElementWithState(HTMLGenericFormElement* e) { m_formElementsWithState.add(e); }
......@@ -724,6 +726,7 @@ protected:
bool m_usesDescendantRules;
bool m_usesSiblingRules;
bool m_usesFirstLineRules;
bool m_usesFirstLetterRules;
String m_title;
bool m_titleSetExplicitly;
......
......@@ -150,6 +150,7 @@ void RenderBlock::setStyle(RenderStyle* _style)
updateBeforeAfterContent(RenderStyle::BEFORE);
updateBeforeAfterContent(RenderStyle::AFTER);
}
updateFirstLetter();
}
void RenderBlock::addChildToFlow(RenderObject* newChild, RenderObject* beforeChild)
......@@ -4042,7 +4043,13 @@ RenderBlock* RenderBlock::firstLineBlock() const
}
void RenderBlock::updateFirstLetter()
{
{
if (!document()->usesFirstLetterRules())
return;
// Don't recurse
if (style()->styleType() == RenderStyle::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.
RenderObject* firstLetterBlock = this;
......
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