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

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

Issue 2171493003: [Editing][DOM][CodeHealth] Make Node::hasEditableStyle global functions. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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 unified diff | Download patch
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 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
740 { 740 {
741 if (selection.isNone()) 741 if (selection.isNone())
742 return FalseTriState; 742 return FalseTriState;
743 743
744 if (selection.isCaret()) 744 if (selection.isCaret())
745 return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection)); 745 return triStateOfStyle(EditingStyle::styleAtSelectionStart(selection));
746 746
747 TriState state = FalseTriState; 747 TriState state = FalseTriState;
748 bool nodeIsStart = true; 748 bool nodeIsStart = true;
749 for (Node& node : NodeTraversal::startsAt(*selection.start().anchorNode())) { 749 for (Node& node : NodeTraversal::startsAt(*selection.start().anchorNode())) {
750 if (node.layoutObject() && node.hasEditableStyle()) { 750 if (node.layoutObject() && hasEditableStyle(node)) {
751 CSSComputedStyleDeclaration* nodeStyle = CSSComputedStyleDeclaration ::create(&node); 751 CSSComputedStyleDeclaration* nodeStyle = CSSComputedStyleDeclaration ::create(&node);
752 if (nodeStyle) { 752 if (nodeStyle) {
753 // If the selected element has <sub> or <sup> ancestor element, apply the corresponding 753 // If the selected element has <sub> or <sup> ancestor element, apply the corresponding
754 // style(vertical-align) to it so that document.queryCommandStat e() works with the style. 754 // style(vertical-align) to it so that document.queryCommandStat e() works with the style.
755 // See bug http://crbug.com/582225. 755 // See bug http://crbug.com/582225.
756 if (m_isVerticalAlign && getIdentifierValue(nodeStyle, CSSProper tyVerticalAlign) == CSSValueBaseline) { 756 if (m_isVerticalAlign && getIdentifierValue(nodeStyle, CSSProper tyVerticalAlign) == CSSValueBaseline) {
757 const CSSPrimitiveValue* verticalAlign = toCSSPrimitiveValue (m_mutableStyle->getPropertyCSSValue(CSSPropertyVerticalAlign)); 757 const CSSPrimitiveValue* verticalAlign = toCSSPrimitiveValue (m_mutableStyle->getPropertyCSSValue(CSSPropertyVerticalAlign));
758 if (hasAncestorVerticalAlignStyle(node, verticalAlign->getVa lueID())) 758 if (hasAncestorVerticalAlignStyle(node, verticalAlign->getVa lueID()))
759 node.mutableComputedStyle()->setVerticalAlign(verticalAl ign->convertTo<EVerticalAlign>()); 759 node.mutableComputedStyle()->setVerticalAlign(verticalAl ign->convertTo<EVerticalAlign>());
760 } 760 }
(...skipping 996 matching lines...) Expand 10 before | Expand all | Expand 10 after
1757 { 1757 {
1758 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { 1758 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
1759 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration ::create(ancestor); 1759 CSSComputedStyleDeclaration* ancestorStyle = CSSComputedStyleDeclaration ::create(ancestor);
1760 if (!hasTransparentBackgroundColor(ancestorStyle)) 1760 if (!hasTransparentBackgroundColor(ancestorStyle))
1761 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); 1761 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor );
1762 } 1762 }
1763 return nullptr; 1763 return nullptr;
1764 } 1764 }
1765 1765
1766 } // namespace blink 1766 } // namespace blink
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698