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 1510 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1521 | 1521 |
1522 EditingStyle* EditingStyle::styleAtSelectionStart( | 1522 EditingStyle* EditingStyle::styleAtSelectionStart( |
1523 const VisibleSelection& selection, | 1523 const VisibleSelection& selection, |
1524 bool shouldUseBackgroundColorInEffect, | 1524 bool shouldUseBackgroundColorInEffect, |
1525 MutableStylePropertySet* styleToCheck) { | 1525 MutableStylePropertySet* styleToCheck) { |
1526 if (selection.isNone()) | 1526 if (selection.isNone()) |
1527 return nullptr; | 1527 return nullptr; |
1528 | 1528 |
1529 Document& document = *selection.start().document(); | 1529 Document& document = *selection.start().document(); |
1530 | 1530 |
1531 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets | 1531 DCHECK(!document.needsLayoutTreeUpdate()); |
1532 // needs to be audited. see http://crbug.com/590369 for more details. | |
1533 document.updateStyleAndLayoutIgnorePendingStylesheets(); | |
1534 | |
1535 DocumentLifecycle::DisallowTransitionScope disallowTransition( | 1532 DocumentLifecycle::DisallowTransitionScope disallowTransition( |
1536 document.lifecycle()); | 1533 document.lifecycle()); |
1537 | 1534 |
1538 Position position = adjustedSelectionStartForStyleComputation(selection); | 1535 Position position = adjustedSelectionStartForStyleComputation(selection); |
1539 | 1536 |
1540 // If the pos is at the end of a text node, then this node is not fully | 1537 // If the pos is at the end of a text node, then this node is not fully |
1541 // selected. Move it to the next deep equivalent position to avoid removing | 1538 // selected. Move it to the next deep equivalent position to avoid removing |
1542 // the style from this node. | 1539 // the style from this node. |
1543 // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>, we | 1540 // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>, we |
1544 // want Position("world", 0) instead. | 1541 // want Position("world", 0) instead. |
(...skipping 495 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2040 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 2037 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
2041 CSSComputedStyleDeclaration* ancestorStyle = | 2038 CSSComputedStyleDeclaration* ancestorStyle = |
2042 CSSComputedStyleDeclaration::create(ancestor); | 2039 CSSComputedStyleDeclaration::create(ancestor); |
2043 if (!hasTransparentBackgroundColor(ancestorStyle)) | 2040 if (!hasTransparentBackgroundColor(ancestorStyle)) |
2044 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor); | 2041 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor); |
2045 } | 2042 } |
2046 return nullptr; | 2043 return nullptr; |
2047 } | 2044 } |
2048 | 2045 |
2049 } // namespace blink | 2046 } // namespace blink |
OLD | NEW |