Skip to content

Commit

Permalink
Reviewed by Sam Weinig.
Browse files Browse the repository at this point in the history
        - fix http://bugs.webkit.org/show_bug.cgi?id=17259
          Element::recalcStyle() needlessly null-checks the result of styleForElement()

        * dom/Element.cpp:
        (WebCore::Element::recalcStyle): Removed unneeded null checks.
        styleForElement() can never return null.



Canonical link: https://commits.webkit.org/23928@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@30117 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Dan Bernstein committed Feb 10, 2008
1 parent df8b58e commit 3e2bcd0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 5 deletions.
11 changes: 11 additions & 0 deletions WebCore/ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 +1,14 @@
2008-02-09 Dan Bernstein <mitz@apple.com>

Reviewed by Sam Weinig.

- fix http://bugs.webkit.org/show_bug.cgi?id=17259
Element::recalcStyle() needlessly null-checks the result of styleForElement()

* dom/Element.cpp:
(WebCore::Element::recalcStyle): Removed unneeded null checks.
styleForElement() can never return null.

2008-02-09 David Hyatt <hyatt@apple.com>

Fix for bug 17254, nth-* selectors do not work with negative coefficients.
Expand Down
9 changes: 4 additions & 5 deletions WebCore/dom/Element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -730,7 +730,7 @@ void Element::recalcStyle(StyleChange change)
return;
}

if (currentStyle && newStyle) {
if (currentStyle) {
// Preserve "affected by" bits that were propagated to us from descendants in the case where we didn't do a full
// style change (e.g., only inline style changed).
if (currentStyle->affectedByHoverRules())
Expand All @@ -749,10 +749,9 @@ void Element::recalcStyle(StyleChange change)
newStyle->setChildrenAffectedByLastChildRules();
}

if (ch != NoChange) {
if (newStyle)
setRenderStyle(newStyle);
} else if (changed() && newStyle && (document()->usesSiblingRules() || document()->usesDescendantRules())) {
if (ch != NoChange)
setRenderStyle(newStyle);
else if (changed() && (document()->usesSiblingRules() || document()->usesDescendantRules())) {
// Although no change occurred, we use the new style so that the cousin style sharing code won't get
// fooled into believing this style is the same. This is only necessary if the document actually uses
// sibling/descendant rules, since otherwise it isn't possible for ancestor styles to affect sharing of
Expand Down

0 comments on commit 3e2bcd0

Please sign in to comment.