Changeset 29944 in webkit
- Timestamp:
- Feb 2, 2008 6:28:46 PM (16 years ago)
- Location:
- trunk
- Files:
-
- 6 added
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LayoutTests/ChangeLog
r29939 r29944 1 2008-02-02 David Hyatt <hyatt@apple.com> 2 3 Add test for bug 5468, supporting :only-child and :only-of-type in CSS3. 4 5 Reviewed by olliej 6 7 * platform/mac/fast/css/only-child-pseudo-class-expected.checksum: Added. 8 * platform/mac/fast/css/only-child-pseudo-class-expected.png: Added. 9 * platform/mac/fast/css/only-child-pseudo-class-expected.txt: Added. 10 * platform/mac/fast/css/only-of-type-pseudo-class-expected.checksum: Added. 11 * platform/mac/fast/css/only-of-type-pseudo-class-expected.png: Added. 12 * platform/mac/fast/css/only-of-type-pseudo-class-expected.txt: Added. 13 1 14 2008-02-02 Darin Adler <darin@apple.com> 2 15 -
trunk/WebCore/ChangeLog
r29943 r29944 1 2008-02-02 David Hyatt <hyatt@apple.com> 2 3 Fix for bug 5468, support CSS3 :only-child and :only-of-type selectors. 4 5 Reviewed by olliej 6 7 Added fast/css/only-child-pseudo-class.html, fast/css/only-of-type-pseudo-class.html 8 9 * css/CSSSelector.cpp: 10 (WebCore::CSSSelector::extractPseudoType): 11 * css/CSSSelector.h: 12 (WebCore::CSSSelector::): 13 * css/CSSStyleSelector.cpp: 14 (WebCore::CSSStyleSelector::checkOneSelector): 15 1 16 2008-02-02 Darin Adler <darin@apple.com> 2 17 -
trunk/WebCore/css/CSSSelector.cpp
r29933 r29944 101 101 static AtomicString mediaControlsFullscreenButton("-webkit-media-controls-fullscreen-button"); 102 102 static AtomicString notStr("not("); 103 static AtomicString onlyChild("only-child"); 104 static AtomicString onlyOfType("only-of-type"); 103 105 static AtomicString root("root"); 104 106 static AtomicString searchCancelButton("-webkit-search-cancel-button"); … … 148 150 else if (m_value == lastOfType) 149 151 m_pseudoType = PseudoLastOfType; 152 else if (m_value == onlyChild) 153 m_pseudoType = PseudoOnlyChild; 154 else if (m_value == onlyOfType) 155 m_pseudoType = PseudoOnlyOfType; 150 156 else if (m_value == firstLetter) { 151 157 m_pseudoType = PseudoFirstLetter; -
trunk/WebCore/css/CSSSelector.h
r29933 r29944 124 124 PseudoLastChild, 125 125 PseudoLastOfType, 126 PseudoOnlyChild, 127 PseudoOnlyOfType, 126 128 PseudoFirstLine, 127 129 PseudoFirstLetter, -
trunk/WebCore/css/CSSStyleSelector.cpp
r29933 r29944 1646 1646 } 1647 1647 case CSSSelector::PseudoLastChild: { 1648 // first-child matches the first child that is an element1648 // last-child matches the last child that is an element 1649 1649 if (e->parentNode() && e->parentNode()->isElementNode()) { 1650 1650 bool result = false; … … 1667 1667 } 1668 1668 case CSSSelector::PseudoLastOfType: { 1669 // first-of-type matches the first element of its type1669 // last-of-type matches the last element of its type 1670 1670 if (e->parentNode() && e->parentNode()->isElementNode()) { 1671 1671 bool result = false; … … 1685 1685 } 1686 1686 return result; 1687 } 1688 break; 1689 } 1690 case CSSSelector::PseudoOnlyChild: { 1691 if (e->parentNode() && e->parentNode()->isElementNode()) { 1692 bool firstChild = false; 1693 bool lastChild = false; 1694 1695 Node* n = e->previousSibling(); 1696 while (n && !n->isElementNode()) 1697 n = n->previousSibling(); 1698 if (!n) 1699 firstChild = true; 1700 if (firstChild) { 1701 n = e->nextSibling(); 1702 while (n && !n->isElementNode()) 1703 n = n->nextSibling(); 1704 if (!n) 1705 lastChild = true; 1706 } 1707 if (!m_collectRulesOnly) { 1708 RenderStyle* childStyle = (m_element == e) ? m_style : e->renderStyle(); 1709 RenderStyle* parentStyle = (m_element == e) ? m_parentStyle : e->parentNode()->renderStyle(); 1710 if (parentStyle) { 1711 parentStyle->setChildrenAffectedByFirstChildRules(); 1712 parentStyle->setChildrenAffectedByLastChildRules(); 1713 } 1714 if (firstChild && childStyle) 1715 childStyle->setFirstChildState(); 1716 if (lastChild && childStyle) 1717 childStyle->setLastChildState(); 1718 } 1719 return firstChild && lastChild; 1720 } 1721 break; 1722 } 1723 case CSSSelector::PseudoOnlyOfType: { 1724 if (e->parentNode() && e->parentNode()->isElementNode()) { 1725 bool firstChild = false; 1726 bool lastChild = false; 1727 const QualifiedName& type = e->tagQName(); 1728 Node* n = e->previousSibling(); 1729 while (n) { 1730 if (n->isElementNode() && static_cast<Element*>(n)->hasTagName(type)) 1731 break; 1732 n = n->previousSibling(); 1733 } 1734 if (!n) 1735 firstChild = true; 1736 if (firstChild) { 1737 n = e->nextSibling(); 1738 while (n) { 1739 if (n->isElementNode() && static_cast<Element*>(n)->hasTagName(type)) 1740 break; 1741 n = n->nextSibling(); 1742 } 1743 if (!n) 1744 lastChild = true; 1745 } 1746 if (!m_collectRulesOnly) { 1747 RenderStyle* parentStyle = (m_element == e) ? m_parentStyle : e->parentNode()->renderStyle(); 1748 if (parentStyle) 1749 parentStyle->setChildrenAffectedByPositionalRules(); 1750 } 1751 return firstChild && lastChild; 1687 1752 } 1688 1753 break;
Note: See TracChangeset
for help on using the changeset viewer.