| 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 1317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1328 return 0; | 1328 return 0; |
| 1329 return legacyFontSizeFromCSSValue(document, toCSSPrimitiveValue(cssValue), | 1329 return legacyFontSizeFromCSSValue(document, toCSSPrimitiveValue(cssValue), |
| 1330 m_isMonospaceFont, AlwaysUseLegacyFontSize); | 1330 m_isMonospaceFont, AlwaysUseLegacyFontSize); |
| 1331 } | 1331 } |
| 1332 | 1332 |
| 1333 EditingStyle* EditingStyle::styleAtSelectionStart(const VisibleSelection& select
ion, bool shouldUseBackgroundColorInEffect, MutableStylePropertySet* styleToChec
k) | 1333 EditingStyle* EditingStyle::styleAtSelectionStart(const VisibleSelection& select
ion, bool shouldUseBackgroundColorInEffect, MutableStylePropertySet* styleToChec
k) |
| 1334 { | 1334 { |
| 1335 if (selection.isNone()) | 1335 if (selection.isNone()) |
| 1336 return nullptr; | 1336 return nullptr; |
| 1337 | 1337 |
| 1338 Document& document = *selection.start().document(); |
| 1339 |
| 1340 // TODO(xiaochengh): The use of updateStyleAndLayoutIgnorePendingStylesheets |
| 1341 // needs to be audited. see http://crbug.com/590369 for more details. |
| 1342 document.updateStyleAndLayoutIgnorePendingStylesheets(); |
| 1343 |
| 1344 DocumentLifecycle::DisallowTransitionScope disallowTransition(document.lifec
ycle()); |
| 1345 |
| 1338 Position position = adjustedSelectionStartForStyleComputation(selection); | 1346 Position position = adjustedSelectionStartForStyleComputation(selection); |
| 1339 | 1347 |
| 1340 // If the pos is at the end of a text node, then this node is not fully sele
cted. | 1348 // If the pos is at the end of a text node, then this node is not fully sele
cted. |
| 1341 // Move it to the next deep equivalent position to avoid removing the style
from this node. | 1349 // Move it to the next deep equivalent position to avoid removing the style
from this node. |
| 1342 // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>,
we want Position("world", 0) instead. | 1350 // e.g. if pos was at Position("hello", 5) in <b>hello<div>world</div></b>,
we want Position("world", 0) instead. |
| 1343 // We only do this for range because caret at Position("hello", 5) in <b>hel
lo</b>world should give you font-weight: bold. | 1351 // We only do this for range because caret at Position("hello", 5) in <b>hel
lo</b>world should give you font-weight: bold. |
| 1344 Node* positionNode = position.computeContainerNode(); | 1352 Node* positionNode = position.computeContainerNode(); |
| 1345 if (selection.isRange() && positionNode && positionNode->isTextNode() && pos
ition.computeOffsetInContainerNode() == positionNode->maxCharacterOffset()) | 1353 if (selection.isRange() && positionNode && positionNode->isTextNode() && pos
ition.computeOffsetInContainerNode() == positionNode->maxCharacterOffset()) |
| 1346 position = nextVisuallyDistinctCandidate(position); | 1354 position = nextVisuallyDistinctCandidate(position); |
| 1347 | 1355 |
| (...skipping 409 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1757 { | 1765 { |
| 1758 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1766 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
| 1759 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration
::create(ancestor); | 1767 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration
::create(ancestor); |
| 1760 if (!hasTransparentBackgroundColor(ancestorStyle)) | 1768 if (!hasTransparentBackgroundColor(ancestorStyle)) |
| 1761 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1769 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
| 1762 } | 1770 } |
| 1763 return nullptr; | 1771 return nullptr; |
| 1764 } | 1772 } |
| 1765 | 1773 |
| 1766 } // namespace blink | 1774 } // namespace blink |
| OLD | NEW |