Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(351)

Side by Side Diff: third_party/WebKit/Source/core/editing/EditingStyle.cpp

Issue 1960553002: Do not ignore the text style properties when checking styles in EditingStyle. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: use w3c test harness Created 4 years, 7 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/execCommand/queryCommandState-03.html ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
744 744
745 if (selection.isCaret()) 745 if (selection.isCaret())
746 return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection)); 746 return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection));
747 747
748 TriState state = FalseTriState; 748 TriState state = FalseTriState;
749 bool nodeIsStart = true; 749 bool nodeIsStart = true;
750 for (Node& node : NodeTraversal::startsAt(selection.start().anchorNode())) { 750 for (Node& node : NodeTraversal::startsAt(selection.start().anchorNode())) {
751 if (node.layoutObject() && node.hasEditableStyle()) { 751 if (node.layoutObject() && node.hasEditableStyle()) {
752 CSSComputedStyleDeclaration* nodeStyle = CSSComputedStyleDeclaration ::create(&node); 752 CSSComputedStyleDeclaration* nodeStyle = CSSComputedStyleDeclaration ::create(&node);
753 if (nodeStyle) { 753 if (nodeStyle) {
754 TriState nodeState = triStateOfStyle(nodeStyle, node.isTextNode( ) ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTextOnlyPr operties); 754 // Pass EditingStyle::DoNotIgnoreTextOnlyProperties without chec king if node.isTextNode()
755 // because the node can be an element node. See bug http://crbug .com/584939.
756 TriState nodeState = triStateOfStyle(nodeStyle, EditingStyle::Do NotIgnoreTextOnlyProperties);
755 if (nodeIsStart) { 757 if (nodeIsStart) {
756 state = nodeState; 758 state = nodeState;
757 nodeIsStart = false; 759 nodeIsStart = false;
758 } else if (state != nodeState && node.isTextNode()) { 760 } else if (state != nodeState && node.isTextNode()) {
759 state = MixedTriState; 761 state = MixedTriState;
760 break; 762 break;
761 } 763 }
762 } 764 }
763 } 765 }
764 if (&node == selection.end().anchorNode()) 766 if (&node == selection.end().anchorNode())
(...skipping 963 matching lines...) Expand 10 before | Expand all | Expand 10 after
1728 { 1730 {
1729 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { 1731 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
1730 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration ::create(ancestor); 1732 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration ::create(ancestor);
1731 if (!hasTransparentBackgroundColor(ancestorStyle)) 1733 if (!hasTransparentBackgroundColor(ancestorStyle))
1732 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); 1734 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor );
1733 } 1735 }
1734 return nullptr; 1736 return nullptr;
1735 } 1737 }
1736 1738
1737 } // namespace blink 1739 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/LayoutTests/editing/execCommand/queryCommandState-03.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698