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 694 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
705 TriState EditingStyle::triStateOfStyle(const VisibleSelection& selection) const | 705 TriState EditingStyle::triStateOfStyle(const VisibleSelection& selection) const |
706 { | 706 { |
707 if (!selection.isCaretOrRange()) | 707 if (!selection.isCaretOrRange()) |
708 return FalseTriState; | 708 return FalseTriState; |
709 | 709 |
710 if (selection.isCaret()) | 710 if (selection.isCaret()) |
711 return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection).ge
t()); | 711 return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection).ge
t()); |
712 | 712 |
713 TriState state = FalseTriState; | 713 TriState state = FalseTriState; |
714 bool nodeIsStart = true; | 714 bool nodeIsStart = true; |
715 for (Node* node = selection.start().deprecatedNode(); node; node = NodeTrave
rsal::next(node)) { | 715 for (Node* node = selection.start().deprecatedNode(); node; node = NodeTrave
rsal::next(*node)) { |
716 if (node->renderer() && node->rendererIsEditable()) { | 716 if (node->renderer() && node->rendererIsEditable()) { |
717 RefPtr<CSSComputedStyleDeclaration> nodeStyle = CSSComputedStyleDecl
aration::create(node); | 717 RefPtr<CSSComputedStyleDeclaration> nodeStyle = CSSComputedStyleDecl
aration::create(node); |
718 if (nodeStyle) { | 718 if (nodeStyle) { |
719 TriState nodeState = triStateOfStyle(nodeStyle.get(), node->isTe
xtNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTex
tOnlyProperties); | 719 TriState nodeState = triStateOfStyle(nodeStyle.get(), node->isTe
xtNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTex
tOnlyProperties); |
720 if (nodeIsStart) { | 720 if (nodeIsStart) { |
721 state = nodeState; | 721 state = nodeState; |
722 nodeIsStart = false; | 722 nodeIsStart = false; |
723 } else if (state != nodeState && node->isTextNode()) { | 723 } else if (state != nodeState && node->isTextNode()) { |
724 state = MixedTriState; | 724 state = MixedTriState; |
725 break; | 725 break; |
(...skipping 567 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1293 Node* node = position.deprecatedNode(); | 1293 Node* node = position.deprecatedNode(); |
1294 if (!node) | 1294 if (!node) |
1295 return NaturalWritingDirection; | 1295 return NaturalWritingDirection; |
1296 | 1296 |
1297 Position end; | 1297 Position end; |
1298 if (selection.isRange()) { | 1298 if (selection.isRange()) { |
1299 end = selection.end().upstream(); | 1299 end = selection.end().upstream(); |
1300 | 1300 |
1301 ASSERT(end.document()); | 1301 ASSERT(end.document()); |
1302 Node* pastLast = Range::create(*end.document(), position.parentAnchoredE
quivalent(), end.parentAnchoredEquivalent())->pastLastNode(); | 1302 Node* pastLast = Range::create(*end.document(), position.parentAnchoredE
quivalent(), end.parentAnchoredEquivalent())->pastLastNode(); |
1303 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(n)) { | 1303 for (Node* n = node; n && n != pastLast; n = NodeTraversal::next(*n)) { |
1304 if (!n->isStyledElement()) | 1304 if (!n->isStyledElement()) |
1305 continue; | 1305 continue; |
1306 | 1306 |
1307 RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclarat
ion::create(n); | 1307 RefPtr<CSSComputedStyleDeclaration> style = CSSComputedStyleDeclarat
ion::create(n); |
1308 RefPtr<CSSValue> unicodeBidi = style->getPropertyCSSValue(CSSPropert
yUnicodeBidi); | 1308 RefPtr<CSSValue> unicodeBidi = style->getPropertyCSSValue(CSSPropert
yUnicodeBidi); |
1309 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) | 1309 if (!unicodeBidi || !unicodeBidi->isPrimitiveValue()) |
1310 continue; | 1310 continue; |
1311 | 1311 |
1312 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get())
->getValueID(); | 1312 CSSValueID unicodeBidiValue = toCSSPrimitiveValue(unicodeBidi.get())
->getValueID(); |
1313 if (unicodeBidiValue == CSSValueEmbed || unicodeBidiValue == CSSValu
eBidiOverride) | 1313 if (unicodeBidiValue == CSSValueEmbed || unicodeBidiValue == CSSValu
eBidiOverride) |
(...skipping 336 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1650 { | 1650 { |
1651 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1651 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1652 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); | 1652 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl
aration::create(ancestor); |
1653 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1653 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
1654 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1654 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
1655 } | 1655 } |
1656 return 0; | 1656 return 0; |
1657 } | 1657 } |
1658 | 1658 |
1659 } | 1659 } |
OLD | NEW |