| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright (C) 2010, Google Inc. All rights reserved. | 2 * Copyright (C) 2010, Google Inc. All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions | 5 * modification, are permitted provided that the following conditions |
| 6 * are met: | 6 * are met: |
| 7 * 1. Redistributions of source code must retain the above copyright | 7 * 1. Redistributions of source code must retain the above copyright |
| 8 * notice, this list of conditions and the following disclaimer. | 8 * notice, this list of conditions and the following disclaimer. |
| 9 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. Redistributions in binary form must reproduce the above copyright |
| 10 * notice, this list of conditions and the following disclaimer in the | 10 * notice, this list of conditions and the following disclaimer in the |
| (...skipping 1058 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1069 if (!element) | 1069 if (!element) |
| 1070 return; | 1070 return; |
| 1071 | 1071 |
| 1072 Element* originalElement = element; | 1072 Element* originalElement = element; |
| 1073 PseudoId elementPseudoId = element->pseudoId(); | 1073 PseudoId elementPseudoId = element->pseudoId(); |
| 1074 if (elementPseudoId) | 1074 if (elementPseudoId) |
| 1075 element = element->parentOrShadowHostElement(); | 1075 element = element->parentOrShadowHostElement(); |
| 1076 | 1076 |
| 1077 // Matched rules. | 1077 // Matched rules. |
| 1078 StyleResolver* styleResolver = element->ownerDocument()->styleResolver(); | 1078 StyleResolver* styleResolver = element->ownerDocument()->styleResolver(); |
| 1079 RefPtr<CSSRuleList> matchedRules = styleResolver->pseudoStyleRulesForElement
(element, elementPseudoId, StyleResolver::AllCSSRules); | 1079 // FIXME: |
| 1080 RefPtr<CSSRuleList> matchedRules = styleResolver->pseudoStyleRulesForElement
(element, elementPseudoId, StyleResolver::AllCSSRules, DoNotIncludeStyleSheetInC
SSOMWrapper); |
| 1080 matchedCSSRules = buildArrayForMatchedRuleList(matchedRules.get(), styleReso
lver, originalElement); | 1081 matchedCSSRules = buildArrayForMatchedRuleList(matchedRules.get(), styleReso
lver, originalElement); |
| 1081 | 1082 |
| 1082 // Pseudo elements. | 1083 // Pseudo elements. |
| 1083 if (!elementPseudoId && (!includePseudo || *includePseudo)) { | 1084 if (!elementPseudoId && (!includePseudo || *includePseudo)) { |
| 1084 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches> > pseudoEle
ments = TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches>::create(); | 1085 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches> > pseudoEle
ments = TypeBuilder::Array<TypeBuilder::CSS::PseudoIdMatches>::create(); |
| 1085 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < AFTER_LAST_IN
TERNAL_PSEUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { | 1086 for (PseudoId pseudoId = FIRST_PUBLIC_PSEUDOID; pseudoId < AFTER_LAST_IN
TERNAL_PSEUDOID; pseudoId = static_cast<PseudoId>(pseudoId + 1)) { |
| 1086 RefPtr<CSSRuleList> matchedRules = styleResolver->pseudoStyleRulesFo
rElement(element, pseudoId, StyleResolver::AllCSSRules); | 1087 RefPtr<CSSRuleList> matchedRules = styleResolver->pseudoStyleRulesFo
rElement(element, pseudoId, StyleResolver::AllCSSRules, DoNotIncludeStyleSheetIn
CSSOMWrapper); |
| 1087 if (matchedRules && matchedRules->length()) { | 1088 if (matchedRules && matchedRules->length()) { |
| 1088 RefPtr<TypeBuilder::CSS::PseudoIdMatches> matches = TypeBuilder:
:CSS::PseudoIdMatches::create() | 1089 RefPtr<TypeBuilder::CSS::PseudoIdMatches> matches = TypeBuilder:
:CSS::PseudoIdMatches::create() |
| 1089 .setPseudoId(static_cast<int>(pseudoId)) | 1090 .setPseudoId(static_cast<int>(pseudoId)) |
| 1090 .setMatches(buildArrayForMatchedRuleList(matchedRules.get(),
styleResolver, element)); | 1091 .setMatches(buildArrayForMatchedRuleList(matchedRules.get(),
styleResolver, element)); |
| 1091 pseudoElements->addItem(matches.release()); | 1092 pseudoElements->addItem(matches.release()); |
| 1092 } | 1093 } |
| 1093 } | 1094 } |
| 1094 | 1095 |
| 1095 pseudoIdMatches = pseudoElements.release(); | 1096 pseudoIdMatches = pseudoElements.release(); |
| 1096 } | 1097 } |
| 1097 | 1098 |
| 1098 // Inherited styles. | 1099 // Inherited styles. |
| 1099 if (!elementPseudoId && (!includeInherited || *includeInherited)) { | 1100 if (!elementPseudoId && (!includeInherited || *includeInherited)) { |
| 1100 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> > entri
es = TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry>::create(); | 1101 RefPtr<TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry> > entri
es = TypeBuilder::Array<TypeBuilder::CSS::InheritedStyleEntry>::create(); |
| 1101 Element* parentElement = element->parentElement(); | 1102 Element* parentElement = element->parentElement(); |
| 1102 while (parentElement) { | 1103 while (parentElement) { |
| 1103 StyleResolver* parentStyleResolver = parentElement->ownerDocument()-
>styleResolver(); | 1104 StyleResolver* parentStyleResolver = parentElement->ownerDocument()-
>styleResolver(); |
| 1104 RefPtr<CSSRuleList> parentMatchedRules = parentStyleResolver->styleR
ulesForElement(parentElement, StyleResolver::AllCSSRules); | 1105 RefPtr<CSSRuleList> parentMatchedRules = parentStyleResolver->styleR
ulesForElement(parentElement, StyleResolver::AllCSSRules, DoNotIncludeStyleSheet
InCSSOMWrapper); |
| 1105 RefPtr<TypeBuilder::CSS::InheritedStyleEntry> entry = TypeBuilder::C
SS::InheritedStyleEntry::create() | 1106 RefPtr<TypeBuilder::CSS::InheritedStyleEntry> entry = TypeBuilder::C
SS::InheritedStyleEntry::create() |
| 1106 .setMatchedCSSRules(buildArrayForMatchedRuleList(parentMatchedRu
les.get(), styleResolver, parentElement)); | 1107 .setMatchedCSSRules(buildArrayForMatchedRuleList(parentMatchedRu
les.get(), styleResolver, parentElement)); |
| 1107 if (parentElement->style() && parentElement->style()->length()) { | 1108 if (parentElement->style() && parentElement->style()->length()) { |
| 1108 InspectorStyleSheetForInlineStyle* styleSheet = asInspectorStyle
Sheet(parentElement); | 1109 InspectorStyleSheetForInlineStyle* styleSheet = asInspectorStyle
Sheet(parentElement); |
| 1109 if (styleSheet) | 1110 if (styleSheet) |
| 1110 entry->setInlineStyle(styleSheet->buildObjectForStyle(styleS
heet->styleForId(InspectorCSSId(styleSheet->id(), 0)))); | 1111 entry->setInlineStyle(styleSheet->buildObjectForStyle(styleS
heet->styleForId(InspectorCSSId(styleSheet->id(), 0)))); |
| 1111 } | 1112 } |
| 1112 | 1113 |
| 1113 entries->addItem(entry.release()); | 1114 entries->addItem(entry.release()); |
| 1114 parentElement = parentElement->parentElement(); | 1115 parentElement = parentElement->parentElement(); |
| (...skipping 776 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1891 documentsToChange.add(element->ownerDocument()); | 1892 documentsToChange.add(element->ownerDocument()); |
| 1892 } | 1893 } |
| 1893 | 1894 |
| 1894 m_nodeIdToForcedPseudoState.clear(); | 1895 m_nodeIdToForcedPseudoState.clear(); |
| 1895 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) | 1896 for (HashSet<Document*>::iterator it = documentsToChange.begin(), end = docu
mentsToChange.end(); it != end; ++it) |
| 1896 (*it)->setNeedsStyleRecalc(); | 1897 (*it)->setNeedsStyleRecalc(); |
| 1897 } | 1898 } |
| 1898 | 1899 |
| 1899 } // namespace WebCore | 1900 } // namespace WebCore |
| 1900 | 1901 |
| OLD | NEW |