OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 2 * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |
3 * (C) 1999 Antti Koivisto (koivisto@kde.org) | 3 * (C) 1999 Antti Koivisto (koivisto@kde.org) |
4 * (C) 2001 Peter Kelly (pmk@post.com) | 4 * (C) 2001 Peter Kelly (pmk@post.com) |
5 * (C) 2001 Dirk Mueller (mueller@kde.org) | 5 * (C) 2001 Dirk Mueller (mueller@kde.org) |
6 * (C) 2007 David Smith (catfish.man@gmail.com) | 6 * (C) 2007 David Smith (catfish.man@gmail.com) |
7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. | 7 * Copyright (C) 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2012, 2013 Apple Inc.
All rights reserved. |
8 * (C) 2007 Eric Seidel (eric@webkit.org) | 8 * (C) 2007 Eric Seidel (eric@webkit.org) |
9 * | 9 * |
10 * This library is free software; you can redistribute it and/or | 10 * This library is free software; you can redistribute it and/or |
(...skipping 1867 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1878 | 1878 |
1879 // :first-child. In the parser callback case, we don't have to check anythi
ng, since we were right the first time. | 1879 // :first-child. In the parser callback case, we don't have to check anythi
ng, since we were right the first time. |
1880 // In the DOM case, we only need to do something if |afterChange| is not 0. | 1880 // In the DOM case, we only need to do something if |afterChange| is not 0. |
1881 // |afterChange| is 0 in the parser case, so it works out that we'll skip th
is block. | 1881 // |afterChange| is 0 in the parser case, so it works out that we'll skip th
is block. |
1882 if (childrenAffectedByFirstChildRules() && afterChange) { | 1882 if (childrenAffectedByFirstChildRules() && afterChange) { |
1883 // Find our new first child. | 1883 // Find our new first child. |
1884 Element* newFirstChild = ElementTraversal::firstWithin(*this); | 1884 Element* newFirstChild = ElementTraversal::firstWithin(*this); |
1885 RenderStyle* newFirstChildStyle = newFirstChild ? newFirstChild->renderS
tyle() : 0; | 1885 RenderStyle* newFirstChildStyle = newFirstChild ? newFirstChild->renderS
tyle() : 0; |
1886 | 1886 |
1887 // Find the first element node following |afterChange| | 1887 // Find the first element node following |afterChange| |
1888 Node* firstElementAfterInsertion = afterChange->isElementNode() ? afterC
hange : afterChange->nextElementSibling(); | 1888 Node* firstElementAfterInsertion = afterChange->isElementNode() ? afterC
hange : ElementTraversal::nextSibling(*afterChange); |
1889 RenderStyle* firstElementAfterInsertionStyle = firstElementAfterInsertio
n ? firstElementAfterInsertion->renderStyle() : 0; | 1889 RenderStyle* firstElementAfterInsertionStyle = firstElementAfterInsertio
n ? firstElementAfterInsertion->renderStyle() : 0; |
1890 | 1890 |
1891 // This is the insert/append case. | 1891 // This is the insert/append case. |
1892 if (newFirstChild != firstElementAfterInsertion && firstElementAfterInse
rtionStyle && firstElementAfterInsertionStyle->firstChildState()) | 1892 if (newFirstChild != firstElementAfterInsertion && firstElementAfterInse
rtionStyle && firstElementAfterInsertionStyle->firstChildState()) |
1893 firstElementAfterInsertion->setNeedsStyleRecalc(SubtreeStyleChange); | 1893 firstElementAfterInsertion->setNeedsStyleRecalc(SubtreeStyleChange); |
1894 | 1894 |
1895 // We also have to handle node removal. | 1895 // We also have to handle node removal. |
1896 if (childCountDelta < 0 && newFirstChild == firstElementAfterInsertion &
& newFirstChild && (!newFirstChildStyle || !newFirstChildStyle->firstChildState(
))) | 1896 if (childCountDelta < 0 && newFirstChild == firstElementAfterInsertion &
& newFirstChild && (!newFirstChildStyle || !newFirstChildStyle->firstChildState(
))) |
1897 newFirstChild->setNeedsStyleRecalc(SubtreeStyleChange); | 1897 newFirstChild->setNeedsStyleRecalc(SubtreeStyleChange); |
1898 } | 1898 } |
1899 | 1899 |
1900 // :last-child. In the parser callback case, we don't have to check anythin
g, since we were right the first time. | 1900 // :last-child. In the parser callback case, we don't have to check anythin
g, since we were right the first time. |
1901 // In the DOM case, we only need to do something if |afterChange| is not 0. | 1901 // In the DOM case, we only need to do something if |afterChange| is not 0. |
1902 if (childrenAffectedByLastChildRules() && beforeChange) { | 1902 if (childrenAffectedByLastChildRules() && beforeChange) { |
1903 // Find our new last child. | 1903 // Find our new last child. |
1904 Node* newLastChild = ElementTraversal::lastWithin(*this); | 1904 Node* newLastChild = ElementTraversal::lastWithin(*this); |
1905 RenderStyle* newLastChildStyle = newLastChild ? newLastChild->renderStyl
e() : 0; | 1905 RenderStyle* newLastChildStyle = newLastChild ? newLastChild->renderStyl
e() : 0; |
1906 | 1906 |
1907 // Find the last element node going backwards from |beforeChange| | 1907 // Find the last element node going backwards from |beforeChange| |
1908 Node* lastElementBeforeInsertion = beforeChange->isElementNode() ? befor
eChange : beforeChange->previousElementSibling(); | 1908 Node* lastElementBeforeInsertion = beforeChange->isElementNode() ? befor
eChange : ElementTraversal::previousSibling(*beforeChange); |
1909 RenderStyle* lastElementBeforeInsertionStyle = lastElementBeforeInsertio
n ? lastElementBeforeInsertion->renderStyle() : 0; | 1909 RenderStyle* lastElementBeforeInsertionStyle = lastElementBeforeInsertio
n ? lastElementBeforeInsertion->renderStyle() : 0; |
1910 | 1910 |
1911 if (newLastChild != lastElementBeforeInsertion && lastElementBeforeInser
tionStyle && lastElementBeforeInsertionStyle->lastChildState()) | 1911 if (newLastChild != lastElementBeforeInsertion && lastElementBeforeInser
tionStyle && lastElementBeforeInsertionStyle->lastChildState()) |
1912 lastElementBeforeInsertion->setNeedsStyleRecalc(SubtreeStyleChange); | 1912 lastElementBeforeInsertion->setNeedsStyleRecalc(SubtreeStyleChange); |
1913 | 1913 |
1914 // We also have to handle node removal. The parser callback case is sim
ilar to node removal as well in that we need to change the last child | 1914 // We also have to handle node removal. The parser callback case is sim
ilar to node removal as well in that we need to change the last child |
1915 // to match now. | 1915 // to match now. |
1916 if ((childCountDelta < 0 || finishedParsingCallback) && newLastChild ==
lastElementBeforeInsertion && newLastChild && (!newLastChildStyle || !newLastChi
ldStyle->lastChildState())) | 1916 if ((childCountDelta < 0 || finishedParsingCallback) && newLastChild ==
lastElementBeforeInsertion && newLastChild && (!newLastChildStyle || !newLastChi
ldStyle->lastChildState())) |
1917 newLastChild->setNeedsStyleRecalc(SubtreeStyleChange); | 1917 newLastChild->setNeedsStyleRecalc(SubtreeStyleChange); |
1918 } | 1918 } |
1919 | 1919 |
1920 // The + selector. We need to invalidate the first element following the in
sertion point. It is the only possible element | 1920 // The + selector. We need to invalidate the first element following the in
sertion point. It is the only possible element |
1921 // that could be affected by this DOM change. | 1921 // that could be affected by this DOM change. |
1922 if (childrenAffectedByDirectAdjacentRules() && afterChange) { | 1922 if (childrenAffectedByDirectAdjacentRules() && afterChange) { |
1923 if (Node* firstElementAfterInsertion = afterChange->isElementNode() ? af
terChange : afterChange->nextElementSibling()) | 1923 if (Node* firstElementAfterInsertion = afterChange->isElementNode() ? af
terChange : ElementTraversal::nextSibling(*afterChange)) |
1924 firstElementAfterInsertion->setNeedsStyleRecalc(SubtreeStyleChange); | 1924 firstElementAfterInsertion->setNeedsStyleRecalc(SubtreeStyleChange); |
1925 } | 1925 } |
1926 } | 1926 } |
1927 | 1927 |
1928 void Element::childrenChanged(bool changedByParser, Node* beforeChange, Node* af
terChange, int childCountDelta) | 1928 void Element::childrenChanged(bool changedByParser, Node* beforeChange, Node* af
terChange, int childCountDelta) |
1929 { | 1929 { |
1930 ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, c
hildCountDelta); | 1930 ContainerNode::childrenChanged(changedByParser, beforeChange, afterChange, c
hildCountDelta); |
1931 if (changedByParser) | 1931 if (changedByParser) |
1932 checkForEmptyStyleChange(renderStyle()); | 1932 checkForEmptyStyleChange(renderStyle()); |
1933 else | 1933 else |
(...skipping 1692 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3626 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems | 3626 // Before doing so, we need to resolve issues in HTMLSelectElement::recalcLi
stItems |
3627 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 | 3627 // and RenderMenuList::setText. See also https://bugs.webkit.org/show_bug.cg
i?id=88405 |
3628 if (hasTagName(optionTag) || hasTagName(optgroupTag)) | 3628 if (hasTagName(optionTag) || hasTagName(optgroupTag)) |
3629 return false; | 3629 return false; |
3630 if (FullscreenElementStack::isActiveFullScreenElement(this)) | 3630 if (FullscreenElementStack::isActiveFullScreenElement(this)) |
3631 return false; | 3631 return false; |
3632 return true; | 3632 return true; |
3633 } | 3633 } |
3634 | 3634 |
3635 } // namespace WebCore | 3635 } // namespace WebCore |
OLD | NEW |