| OLD | NEW | 
|     1 /* |     1 /* | 
|     2  * Copyright (C) 1999 Lars Knoll (knoll@kde.org) |     2  * Copyright (C) 1999 Lars Knoll (knoll@kde.org) | 
|     3  *           (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) |     3  *           (C) 2004-2005 Allan Sandfeld Jensen (kde@carewolf.com) | 
|     4  * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) |     4  * Copyright (C) 2006, 2007 Nicholas Shanks (webkit@nickshanks.com) | 
|     5  * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
      ights reserved. |     5  * Copyright (C) 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 Apple Inc. All r
      ights reserved. | 
|     6  * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> |     6  * Copyright (C) 2007 Alexey Proskuryakov <ap@webkit.org> | 
|     7  * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> |     7  * Copyright (C) 2007, 2008 Eric Seidel <eric@webkit.org> | 
|     8  * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
      orchmobile.com/) |     8  * Copyright (C) 2008, 2009 Torch Mobile Inc. All rights reserved. (http://www.t
      orchmobile.com/) | 
|     9  * Copyright (c) 2011, Code Aurora Forum. All rights reserved. |     9  * Copyright (c) 2011, Code Aurora Forum. All rights reserved. | 
|    10  * Copyright (C) Research In Motion Limited 2011. All rights reserved. |    10  * Copyright (C) Research In Motion Limited 2011. All rights reserved. | 
| (...skipping 982 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|   993     m_pendingImageProperties.clear(); |   993     m_pendingImageProperties.clear(); | 
|   994  |   994  | 
|   995     m_ruleList = 0; |   995     m_ruleList = 0; | 
|   996  |   996  | 
|   997     m_fontDirty = false; |   997     m_fontDirty = false; | 
|   998 } |   998 } | 
|   999  |   999  | 
|  1000 static const unsigned cStyleSearchThreshold = 10; |  1000 static const unsigned cStyleSearchThreshold = 10; | 
|  1001 static const unsigned cStyleSearchLevelThreshold = 10; |  1001 static const unsigned cStyleSearchLevelThreshold = 10; | 
|  1002  |  1002  | 
 |  1003 static inline bool parentElementPreventsSharing(const Element* parentElement) | 
 |  1004 { | 
 |  1005     if (!parentElement) | 
 |  1006         return false; | 
 |  1007     return parentElement->hasFlagsSetDuringStylingOfChildren(); | 
 |  1008 } | 
 |  1009  | 
|  1003 Node* StyleResolver::locateCousinList(Element* parent, unsigned& visitedNodeCoun
      t) const |  1010 Node* StyleResolver::locateCousinList(Element* parent, unsigned& visitedNodeCoun
      t) const | 
|  1004 { |  1011 { | 
|  1005     if (visitedNodeCount >= cStyleSearchThreshold * cStyleSearchLevelThreshold) |  1012     if (visitedNodeCount >= cStyleSearchThreshold * cStyleSearchLevelThreshold) | 
|  1006         return 0; |  1013         return 0; | 
|  1007     if (!parent || !parent->isStyledElement()) |  1014     if (!parent || !parent->isStyledElement()) | 
|  1008         return 0; |  1015         return 0; | 
|  1009     if (parent->hasScopedHTMLStyleChild()) |  1016     if (parent->hasScopedHTMLStyleChild()) | 
|  1010         return 0; |  1017         return 0; | 
|  1011     StyledElement* p = static_cast<StyledElement*>(parent); |  1018     StyledElement* p = static_cast<StyledElement*>(parent); | 
|  1012     if (p->inlineStyle()) |  1019     if (p->inlineStyle()) | 
|  1013         return 0; |  1020         return 0; | 
|  1014 #if ENABLE(SVG) |  1021 #if ENABLE(SVG) | 
|  1015     if (p->isSVGElement() && static_cast<SVGElement*>(p)->animatedSMILStylePrope
      rties()) |  1022     if (p->isSVGElement() && static_cast<SVGElement*>(p)->animatedSMILStylePrope
      rties()) | 
|  1016         return 0; |  1023         return 0; | 
|  1017 #endif |  1024 #endif | 
|  1018     if (p->hasID() && m_features.idsInRules.contains(p->idForStyleResolution().i
      mpl())) |  1025     if (p->hasID() && m_features.idsInRules.contains(p->idForStyleResolution().i
      mpl())) | 
|  1019         return 0; |  1026         return 0; | 
|  1020  |  1027  | 
|  1021     RenderStyle* parentStyle = p->renderStyle(); |  1028     RenderStyle* parentStyle = p->renderStyle(); | 
|  1022     unsigned subcount = 0; |  1029     unsigned subcount = 0; | 
|  1023     Node* thisCousin = p; |  1030     Node* thisCousin = p; | 
|  1024     Node* currentNode = p->previousSibling(); |  1031     Node* currentNode = p->previousSibling(); | 
|  1025  |  1032  | 
|  1026     // Reserve the tries for this level. This effectively makes sure that the al
      gorithm |  1033     // Reserve the tries for this level. This effectively makes sure that the al
      gorithm | 
|  1027     // will never go deeper than cStyleSearchLevelThreshold levels into recursio
      n. |  1034     // will never go deeper than cStyleSearchLevelThreshold levels into recursio
      n. | 
|  1028     visitedNodeCount += cStyleSearchThreshold; |  1035     visitedNodeCount += cStyleSearchThreshold; | 
|  1029     while (thisCousin) { |  1036     while (thisCousin) { | 
|  1030         while (currentNode) { |  1037         while (currentNode) { | 
|  1031             ++subcount; |  1038             ++subcount; | 
|  1032             if (currentNode->renderStyle() == parentStyle && currentNode->lastCh
      ild()) { |  1039             if (currentNode->renderStyle() == parentStyle && currentNode->lastCh
      ild() | 
 |  1040                 && currentNode->isElementNode() && !parentElementPreventsSharing
      (toElement(currentNode))) { | 
|  1033                 // Adjust for unused reserved tries. |  1041                 // Adjust for unused reserved tries. | 
|  1034                 visitedNodeCount -= cStyleSearchThreshold - subcount; |  1042                 visitedNodeCount -= cStyleSearchThreshold - subcount; | 
|  1035                 return currentNode->lastChild(); |  1043                 return currentNode->lastChild(); | 
|  1036             } |  1044             } | 
|  1037             if (subcount >= cStyleSearchThreshold) |  1045             if (subcount >= cStyleSearchThreshold) | 
|  1038                 return 0; |  1046                 return 0; | 
|  1039             currentNode = currentNode->previousSibling(); |  1047             currentNode = currentNode->previousSibling(); | 
|  1040         } |  1048         } | 
|  1041         currentNode = locateCousinList(thisCousin->parentElement(), visitedNodeC
      ount); |  1049         currentNode = locateCousinList(thisCousin->parentElement(), visitedNodeC
      ount); | 
|  1042         thisCousin = currentNode; |  1050         thisCousin = currentNode; | 
| (...skipping 198 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  1241         if (!node->isStyledElement()) |  1249         if (!node->isStyledElement()) | 
|  1242             continue; |  1250             continue; | 
|  1243         if (canShareStyleWithElement(static_cast<StyledElement*>(node))) |  1251         if (canShareStyleWithElement(static_cast<StyledElement*>(node))) | 
|  1244             break; |  1252             break; | 
|  1245         if (count++ == cStyleSearchThreshold) |  1253         if (count++ == cStyleSearchThreshold) | 
|  1246             return 0; |  1254             return 0; | 
|  1247     } |  1255     } | 
|  1248     return static_cast<StyledElement*>(node); |  1256     return static_cast<StyledElement*>(node); | 
|  1249 } |  1257 } | 
|  1250  |  1258  | 
|  1251 static inline bool parentElementPreventsSharing(const Element* parentElement) |  | 
|  1252 { |  | 
|  1253     if (!parentElement) |  | 
|  1254         return false; |  | 
|  1255     return parentElement->childrenAffectedByPositionalRules() |  | 
|  1256         || parentElement->childrenAffectedByFirstChildRules() |  | 
|  1257         || parentElement->childrenAffectedByLastChildRules() |  | 
|  1258         || parentElement->childrenAffectedByDirectAdjacentRules(); |  | 
|  1259 } |  | 
|  1260  |  | 
|  1261 RenderStyle* StyleResolver::locateSharedStyle() |  1259 RenderStyle* StyleResolver::locateSharedStyle() | 
|  1262 { |  1260 { | 
|  1263     if (!m_styledElement || !m_parentStyle) |  1261     if (!m_styledElement || !m_parentStyle) | 
|  1264         return 0; |  1262         return 0; | 
|  1265     // If the element has inline style it is probably unique. |  1263     // If the element has inline style it is probably unique. | 
|  1266     if (m_styledElement->inlineStyle()) |  1264     if (m_styledElement->inlineStyle()) | 
|  1267         return 0; |  1265         return 0; | 
|  1268 #if ENABLE(SVG) |  1266 #if ENABLE(SVG) | 
|  1269     if (m_styledElement->isSVGElement() && static_cast<SVGElement*>(m_styledElem
      ent)->animatedSMILStyleProperties()) |  1267     if (m_styledElement->isSVGElement() && static_cast<SVGElement*>(m_styledElem
      ent)->animatedSMILStyleProperties()) | 
|  1270         return 0; |  1268         return 0; | 
| (...skipping 4060 matching lines...) Expand 10 before | Expand all | Expand 10 after  Loading... | 
|  5331     info.addMember(m_scopeResolver); |  5329     info.addMember(m_scopeResolver); | 
|  5332  |  5330  | 
|  5333     // FIXME: move this to a place where it would be called only once? |  5331     // FIXME: move this to a place where it would be called only once? | 
|  5334     info.addMember(defaultStyle); |  5332     info.addMember(defaultStyle); | 
|  5335     info.addMember(defaultQuirksStyle); |  5333     info.addMember(defaultQuirksStyle); | 
|  5336     info.addMember(defaultPrintStyle); |  5334     info.addMember(defaultPrintStyle); | 
|  5337     info.addMember(defaultViewSourceStyle); |  5335     info.addMember(defaultViewSourceStyle); | 
|  5338 } |  5336 } | 
|  5339  |  5337  | 
|  5340 } // namespace WebCore |  5338 } // namespace WebCore | 
| OLD | NEW |