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

Unified Diff: Source/core/editing/EditingStyle.cpp

Issue 19888007: Bold and Italic style get stuck when applied on a selection having content with mixed editability (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Bold and Italic style get stuck when applied on a selection having content with mixed editability Created 7 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « LayoutTests/editing/style/toggle-style-bold-italic-mixed-editability-expected.txt ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/EditingStyle.cpp
diff --git a/Source/core/editing/EditingStyle.cpp b/Source/core/editing/EditingStyle.cpp
index 82e5cd2352f5b2ca3b55eb150369922558b0388d..94915548ce017a13b75a80f91cfc8d52354b65eb 100644
--- a/Source/core/editing/EditingStyle.cpp
+++ b/Source/core/editing/EditingStyle.cpp
@@ -697,15 +697,19 @@ TriState EditingStyle::triStateOfStyle(const VisibleSelection& selection) const
return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection).get());
TriState state = FalseTriState;
+ bool nodeIsStart = true;
for (Node* node = selection.start().deprecatedNode(); node; node = NodeTraversal::next(node)) {
- RefPtr<CSSComputedStyleDeclaration> nodeStyle = CSSComputedStyleDeclaration::create(node);
- if (nodeStyle) {
- TriState nodeState = triStateOfStyle(nodeStyle.get(), node->isTextNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTextOnlyProperties);
- if (node == selection.start().deprecatedNode())
- state = nodeState;
- else if (state != nodeState && node->isTextNode()) {
- state = MixedTriState;
- break;
+ if (node->renderer() && node->rendererIsEditable()) {
+ RefPtr<CSSComputedStyleDeclaration> nodeStyle = CSSComputedStyleDeclaration::create(node);
+ if (nodeStyle) {
+ TriState nodeState = triStateOfStyle(nodeStyle.get(), node->isTextNode() ? EditingStyle::DoNotIgnoreTextOnlyProperties : EditingStyle::IgnoreTextOnlyProperties);
+ if (nodeIsStart) {
+ state = nodeState;
+ nodeIsStart = false;
+ } else if (state != nodeState && node->isTextNode()) {
+ state = MixedTriState;
+ break;
+ }
}
}
if (node == selection.end().deprecatedNode())
« no previous file with comments | « LayoutTests/editing/style/toggle-style-bold-italic-mixed-editability-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698