diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog index 7cbdec5a74759f4a2bbae1734f2eec47f73d71ff..c31f0934c3b2bd801af973c845633b51dc8cba22 100644 --- a/LayoutTests/ChangeLog +++ b/LayoutTests/ChangeLog @@ -1,3 +1,16 @@ +2010-02-17 Yuzo Fujishima + + 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 Reviewed by Eric Seidel. diff --git a/LayoutTests/fast/css/first-letter-first-line-hover.html b/LayoutTests/fast/css/first-letter-first-line-hover.html new file mode 100644 index 0000000000000000000000000000000000000000..9b9637335877111230ed5a9a5aee3d6dd2ba2b8e --- /dev/null +++ b/LayoutTests/fast/css/first-letter-first-line-hover.html @@ -0,0 +1,44 @@ + + + + + + + + + +

+ABCDEFG
+ +Hover over "A". It must stay green. + +

+ + diff --git a/LayoutTests/platform/mac/fast/css/first-letter-first-line-hover-expected.checksum b/LayoutTests/platform/mac/fast/css/first-letter-first-line-hover-expected.checksum new file mode 100644 index 0000000000000000000000000000000000000000..1bd4981e33caf32245bef197263dbfec449d0972 --- /dev/null +++ b/LayoutTests/platform/mac/fast/css/first-letter-first-line-hover-expected.checksum @@ -0,0 +1 @@ +9e02fc2e065df643a8a507394c13825c diff --git a/LayoutTests/platform/mac/fast/css/first-letter-first-line-hover-expected.png b/LayoutTests/platform/mac/fast/css/first-letter-first-line-hover-expected.png new file mode 100644 index 0000000000000000000000000000000000000000..fb5e9ff943cf393ba301f1d0cc00b100ecd31928 Binary files /dev/null and b/LayoutTests/platform/mac/fast/css/first-letter-first-line-hover-expected.png differ diff --git a/LayoutTests/platform/mac/fast/css/first-letter-first-line-hover-expected.txt b/LayoutTests/platform/mac/fast/css/first-letter-first-line-hover-expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..98fcd5436cc6669bb0b0e052f032a29a43ca9456 --- /dev/null +++ b/LayoutTests/platform/mac/fast/css/first-letter-first-line-hover-expected.txt @@ -0,0 +1,16 @@ +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 diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog index b9dd09a44ebc40b75ce12f2e274a3adfce152004..8a7a9506389ca0dc1f01c13294477900d052100c 100644 --- a/WebCore/ChangeLog +++ b/WebCore/ChangeLog @@ -1,3 +1,21 @@ +2010-02-17 Yuzo Fujishima + + 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 Reviewed by Eric Seidel. diff --git a/WebCore/dom/Node.cpp b/WebCore/dom/Node.cpp index 1baca9fbf85931593c2d2032bc66b4fc2a766711..b8971778bc3c084acc757fa7ed1850b42bc1f429 100644 --- a/WebCore/dom/Node.cpp +++ b/WebCore/dom/Node.cpp @@ -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 + 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; } diff --git a/WebCore/rendering/style/RenderStyle.cpp b/WebCore/rendering/style/RenderStyle.cpp index 09525575c06187cb2d9b9bc4d88e9375c96310ce..712344fdd27c521df96ff32f8398d66aeb1b7cbe 100644 --- a/WebCore/rendering/style/RenderStyle.cpp +++ b/WebCore/rendering/style/RenderStyle.cpp @@ -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); diff --git a/WebCore/rendering/style/RenderStyle.h b/WebCore/rendering/style/RenderStyle.h index 5a60dea8114b2a1b992fd7c8bb921c1bfc72052a..6ec05343c56d134a4611ebd1f0c452b467d0533e 100644 --- a/WebCore/rendering/style/RenderStyle.h +++ b/WebCore/rendering/style/RenderStyle.h @@ -350,6 +350,7 @@ public: bool isStyleAvailable() const; + bool hasAnyPublicPseudoStyles() const; bool hasPseudoStyle(PseudoId pseudo) const; void setHasPseudoStyle(PseudoId pseudo); diff --git a/WebCore/rendering/style/RenderStyleConstants.h b/WebCore/rendering/style/RenderStyleConstants.h index 01862f6e3fbd5ebefb12d9b24b59e55ef1ed698d..4abbc1c278204dc69ee23c629a0a32a716c5de2c 100644 --- a/WebCore/rendering/style/RenderStyleConstants.h +++ b/WebCore/rendering/style/RenderStyleConstants.h @@ -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