Commit 0b21a9bf authored by eric@webkit.org's avatar eric@webkit.org

2010-02-17 Yuzo Fujishima <yuzo@google.com>

        Reviewed by Eric Seidel.

        In diffing render styles, consider all pseudo style changes.
        Without this patch, only :before and :after are considered. This is the cause of the following bug.
        https://bugs.webkit.org/show_bug.cgi?id=32187

        * fast/css/first-letter-first-line-hover.html: Added.
        * platform/mac/fast/css/first-letter-first-line-hover-expected.checksum: Added.
        * platform/mac/fast/css/first-letter-first-line-hover-expected.png: Added.
        * platform/mac/fast/css/first-letter-first-line-hover-expected.txt: Added.
2010-02-17  Yuzo Fujishima  <yuzo@google.com>

        Reviewed by Eric Seidel.

        In diffing render styles, consider all pseudo style changes.
        Without this patch, only :before and :after are considered. This is the cause of the following bug.
        https://bugs.webkit.org/show_bug.cgi?id=32187

        Test: fast/css/first-letter-first-line-hover.html

        * dom/Node.cpp:
        (WebCore::Node::diff):
        * rendering/style/RenderStyle.cpp:
        (WebCore::RenderStyle::hasAnyPublicPseudoStyles):
        * rendering/style/RenderStyle.h:
        * rendering/style/RenderStyleConstants.h:
        (WebCore::):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@54926 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent 9f6d7a00
2010-02-17 Yuzo Fujishima <yuzo@google.com>
Reviewed by Eric Seidel.
In diffing render styles, consider all pseudo style changes.
Without this patch, only :before and :after are considered. This is the cause of the following bug.
https://bugs.webkit.org/show_bug.cgi?id=32187
* fast/css/first-letter-first-line-hover.html: Added.
* platform/mac/fast/css/first-letter-first-line-hover-expected.checksum: Added.
* platform/mac/fast/css/first-letter-first-line-hover-expected.png: Added.
* platform/mac/fast/css/first-letter-first-line-hover-expected.txt: Added.
2010-02-17 Shinichiro Hamaji <hamaji@chromium.org>
Reviewed by Eric Seidel.
......
<html>
<head>
<title></title>
<style type="text/css">
* {
color:red;
font-size:48px;
}
.description {
color:black;
font-size:16px;
}
p:first-line {
color:green;
}
p:first-letter {
background-color:pink;
}
p:hover {
/* empty */
}
</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(24, 24); // Hover.
document.body.offsetTop; // Update layout for hovered state.
}
</script>
</head>
<body onload="test()">
<p>
ABCDEFG<br/>
<span class="description">
Hover over "A". It must stay green.
</span>
</p>
</body>
</html>
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 [color=#FF0000]
RenderBody {BODY} at (8,8) size 784x544
RenderBlock {P} at (0,0) size 784x73
RenderInline (generated) at (0,0) size 35x55 [color=#008000] [bgcolor=#FFC0CB]
RenderText {#text} at (0,0) size 35x55
text run at (0,0) width 35: "A"
RenderText {#text} at (35,0) size 190x55
text run at (35,0) width 190: "BCDEFG"
RenderBR {BR} at (225,43) size 0x0
RenderInline {SPAN} at (0,0) size 225x18 [color=#000000]
RenderText {#text} at (0,55) size 225x18
text run at (0,55) width 225: "Hover over \"A\". It must stay green."
RenderText {#text} at (0,0) size 0x0
2010-02-17 Yuzo Fujishima <yuzo@google.com>
Reviewed by Eric Seidel.
In diffing render styles, consider all pseudo style changes.
Without this patch, only :before and :after are considered. This is the cause of the following bug.
https://bugs.webkit.org/show_bug.cgi?id=32187
Test: fast/css/first-letter-first-line-hover.html
* dom/Node.cpp:
(WebCore::Node::diff):
* rendering/style/RenderStyle.cpp:
(WebCore::RenderStyle::hasAnyPublicPseudoStyles):
* rendering/style/RenderStyle.h:
* rendering/style/RenderStyleConstants.h:
(WebCore::):
2010-02-17 Kwang Yul Seo <skyul@company100.net>
Reviewed by Eric Seidel.
......
......@@ -313,25 +313,20 @@ Node::StyleChange Node::diff(const RenderStyle* s1, const RenderStyle* s2)
// If the pseudoStyles have changed, we want any StyleChange that is not NoChange
// because setStyle will do the right thing with anything else.
if (ch == NoChange && s1->hasPseudoStyle(BEFORE)) {
RenderStyle* ps2 = s2->getCachedPseudoStyle(BEFORE);
if (!ps2)
ch = NoInherit;
else {
RenderStyle* ps1 = s1->getCachedPseudoStyle(BEFORE);
ch = ps1 && *ps1 == *ps2 ? NoChange : NoInherit;
}
}
if (ch == NoChange && s1->hasPseudoStyle(AFTER)) {
RenderStyle* ps2 = s2->getCachedPseudoStyle(AFTER);
if (!ps2)
ch = NoInherit;
else {
RenderStyle* ps1 = s1->getCachedPseudoStyle(AFTER);
ch = ps2 && *ps1 == *ps2 ? NoChange : NoInherit;
if (ch == NoChange && s1->hasAnyPublicPseudoStyles()) {
for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; ch == NoChange && pseudoId < FIRST_INTERNAL_PSEUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) {
if (s1->hasPseudoStyle(pseudoId)) {
RenderStyle* ps2 = s2->getCachedPseudoStyle(pseudoId);
if (!ps2)
ch = NoInherit;
else {
RenderStyle* ps1 = s1->getCachedPseudoStyle(pseudoId);
ch = ps1 && *ps1 == *ps2 ? NoChange : NoInherit;
}
}
}
}
return ch;
}
......
......@@ -192,6 +192,11 @@ static inline int pseudoBit(PseudoId pseudo)
return 1 << (pseudo - 1);
}
bool RenderStyle::hasAnyPublicPseudoStyles() const
{
return PUBLIC_PSEUDOID_MASK & noninherited_flags._pseudoBits;
}
bool RenderStyle::hasPseudoStyle(PseudoId pseudo) const
{
ASSERT(pseudo > NOPSEUDO);
......
......@@ -350,6 +350,7 @@ public:
bool isStyleAvailable() const;
bool hasAnyPublicPseudoStyles() const;
bool hasPseudoStyle(PseudoId pseudo) const;
void setHasPseudoStyle(PseudoId pseudo);
......
......@@ -66,6 +66,7 @@ enum StyleDifferenceContextSensitiveProperty {
// Static pseudo styles. Dynamic ones are produced on the fly.
enum PseudoId {
// The order must be NOP ID, public IDs, and then internal IDs.
NOPSEUDO, FIRST_LINE, FIRST_LETTER, BEFORE, AFTER, SELECTION, FIRST_LINE_INHERITED, SCROLLBAR, FILE_UPLOAD_BUTTON, INPUT_PLACEHOLDER,
SLIDER_THUMB, SEARCH_CANCEL_BUTTON, SEARCH_DECORATION, SEARCH_RESULTS_DECORATION, SEARCH_RESULTS_BUTTON, MEDIA_CONTROLS_PANEL,
MEDIA_CONTROLS_PLAY_BUTTON, MEDIA_CONTROLS_MUTE_BUTTON, MEDIA_CONTROLS_TIMELINE, MEDIA_CONTROLS_TIMELINE_CONTAINER,
......@@ -75,7 +76,9 @@ enum PseudoId {
MEDIA_CONTROLS_STATUS_DISPLAY, SCROLLBAR_THUMB, SCROLLBAR_BUTTON, SCROLLBAR_TRACK, SCROLLBAR_TRACK_PIECE, SCROLLBAR_CORNER, RESIZER,
INPUT_LIST_BUTTON, INNER_SPIN_BUTTON, OUTER_SPIN_BUTTON,
FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON
FIRST_PUBLIC_PSEUDOID = FIRST_LINE,
FIRST_INTERNAL_PSEUDOID = FILE_UPLOAD_BUTTON,
PUBLIC_PSEUDOID_MASK = ((1 << FIRST_INTERNAL_PSEUDOID) - 1) & ~((1 << FIRST_PUBLIC_PSEUDOID) - 1)
};
// These have been defined in the order of their precedence for border-collapsing. Do
......
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