Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 /* | 1 /* |
| 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc. | 2 * Copyright (C) 2007, 2008, 2009 Apple Computer, Inc. |
| 3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. | 3 * Copyright (C) 2010, 2011 Google Inc. All rights reserved. |
| 4 * | 4 * |
| 5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
| 6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
| 7 * are met: | 7 * are met: |
| 8 * 1. Redistributions of source code must retain the above copyright | 8 * 1. Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * 2. Redistributions in binary form must reproduce the above copyright | 10 * 2. Redistributions in binary form must reproduce the above copyright |
| (...skipping 1395 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1406 styleToRemovePropertiesFrom->removePropertiesInSet(propertiesToRemove.data(), | 1406 styleToRemovePropertiesFrom->removePropertiesInSet(propertiesToRemove.data(), |
| 1407 propertiesToRemove.size()); | 1407 propertiesToRemove.size()); |
| 1408 } | 1408 } |
| 1409 | 1409 |
| 1410 void EditingStyle::removeStyleFromRulesAndContext(Element* element, | 1410 void EditingStyle::removeStyleFromRulesAndContext(Element* element, |
| 1411 ContainerNode* context) { | 1411 ContainerNode* context) { |
| 1412 DCHECK(element); | 1412 DCHECK(element); |
| 1413 if (!m_mutableStyle) | 1413 if (!m_mutableStyle) |
| 1414 return; | 1414 return; |
| 1415 | 1415 |
| 1416 // TODO(yosin): The use of updateStyleAndLayoutIgnorePendingStylesheets | 1416 // StyleResolver requires clean style. |
| 1417 // needs to be audited. see http://crbug.com/590369 for more details. | 1417 DCHECK_GE(element->document().lifecycle().state(), |
|
yosin_UTC9
2016/10/17 09:45:18
Could you add DCHECK(element->document().lifecylce
Xiaocheng
2016/10/17 10:07:27
Thanks for the catch. Done.
| |
| 1418 element->document().updateStyleAndLayoutIgnorePendingStylesheetsForNode( | 1418 DocumentLifecycle::StyleClean); |
| 1419 element); | |
| 1420 | 1419 |
| 1421 // 1. Remove style from matched rules because style remain without repeating | 1420 // 1. Remove style from matched rules because style remain without repeating |
| 1422 // it in inline style declaration | 1421 // it in inline style declaration |
| 1423 MutableStylePropertySet* styleFromMatchedRules = | 1422 MutableStylePropertySet* styleFromMatchedRules = |
| 1424 styleFromMatchedRulesForElement(element, | 1423 styleFromMatchedRulesForElement(element, |
| 1425 StyleResolver::AllButEmptyCSSRules); | 1424 StyleResolver::AllButEmptyCSSRules); |
| 1426 if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty()) | 1425 if (styleFromMatchedRules && !styleFromMatchedRules->isEmpty()) |
| 1427 m_mutableStyle = | 1426 m_mutableStyle = |
| 1428 getPropertiesNotIn(m_mutableStyle.get(), | 1427 getPropertiesNotIn(m_mutableStyle.get(), |
| 1429 styleFromMatchedRules->ensureCSSStyleDeclaration()); | 1428 styleFromMatchedRules->ensureCSSStyleDeclaration()); |
| (...skipping 610 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2040 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 2039 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 2041 CSSComputedStyleDeclaration* ancestorStyle = | 2040 CSSComputedStyleDeclaration* ancestorStyle = |
| 2042 CSSComputedStyleDeclaration::create(ancestor); | 2041 CSSComputedStyleDeclaration::create(ancestor); |
| 2043 if (!hasTransparentBackgroundColor(ancestorStyle)) | 2042 if (!hasTransparentBackgroundColor(ancestorStyle)) |
| 2044 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor); | 2043 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor); |
| 2045 } | 2044 } |
| 2046 return nullptr; | 2045 return nullptr; |
| 2047 } | 2046 } |
| 2048 | 2047 |
| 2049 } // namespace blink | 2048 } // namespace blink |
| OLD | NEW |