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

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

Issue 272753003: During editing, merge inline style with overriding other author styles (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 6 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
« no previous file with comments | « LayoutTests/editing/deleting/merge-div-with-inline-style-expected.txt ('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 1017 matching lines...) Expand 10 before | Expand all | Expand 10 after
1028 } 1028 }
1029 1029
1030 ASSERT_NOT_REACHED(); 1030 ASSERT_NOT_REACHED();
1031 return nullptr; 1031 return nullptr;
1032 } 1032 }
1033 1033
1034 void EditingStyle::mergeInlineAndImplicitStyleOfElement(Element* element, CSSPro pertyOverrideMode mode, PropertiesToInclude propertiesToInclude) 1034 void EditingStyle::mergeInlineAndImplicitStyleOfElement(Element* element, CSSPro pertyOverrideMode mode, PropertiesToInclude propertiesToInclude)
1035 { 1035 {
1036 RefPtrWillBeRawPtr<EditingStyle> styleFromRules = EditingStyle::create(); 1036 RefPtrWillBeRawPtr<EditingStyle> styleFromRules = EditingStyle::create();
1037 styleFromRules->mergeStyleFromRulesForSerialization(element); 1037 styleFromRules->mergeStyleFromRulesForSerialization(element);
1038
1039 if (element->inlineStyle())
1040 styleFromRules->m_mutableStyle->mergeAndOverrideOnConflict(element->inli neStyle());
1041
1038 styleFromRules->m_mutableStyle = extractEditingProperties(styleFromRules->m_ mutableStyle.get(), propertiesToInclude); 1042 styleFromRules->m_mutableStyle = extractEditingProperties(styleFromRules->m_ mutableStyle.get(), propertiesToInclude);
1039 mergeStyle(styleFromRules->m_mutableStyle.get(), mode); 1043 mergeStyle(styleFromRules->m_mutableStyle.get(), mode);
1040 1044
1041 mergeInlineStyleOfElement(element, mode, propertiesToInclude);
1042
1043 const WillBeHeapVector<OwnPtrWillBeMember<HTMLElementEquivalent> >& elementE quivalents = htmlElementEquivalents(); 1045 const WillBeHeapVector<OwnPtrWillBeMember<HTMLElementEquivalent> >& elementE quivalents = htmlElementEquivalents();
1044 for (size_t i = 0; i < elementEquivalents.size(); ++i) { 1046 for (size_t i = 0; i < elementEquivalents.size(); ++i) {
1045 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(elementEquivalents[i ].get(), element, mode, m_mutableStyle.get())) 1047 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(elementEquivalents[i ].get(), element, mode, m_mutableStyle.get()))
1046 elementEquivalents[i]->addToStyle(element, this); 1048 elementEquivalents[i]->addToStyle(element, this);
1047 } 1049 }
1048 1050
1049 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent> >& attrib uteEquivalents = htmlAttributeEquivalents(); 1051 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent> >& attrib uteEquivalents = htmlAttributeEquivalents();
1050 for (size_t i = 0; i < attributeEquivalents.size(); ++i) { 1052 for (size_t i = 0; i < attributeEquivalents.size(); ++i) {
1051 if (attributeEquivalents[i]->attributeName() == HTMLNames::dirAttr) 1053 if (attributeEquivalents[i]->attributeName() == HTMLNames::dirAttr)
1052 continue; // We don't want to include directionality 1054 continue; // We don't want to include directionality
(...skipping 620 matching lines...) Expand 10 before | Expand all | Expand 10 after
1673 { 1675 {
1674 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { 1676 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
1675 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor); 1677 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor);
1676 if (!hasTransparentBackgroundColor(ancestorStyle.get())) 1678 if (!hasTransparentBackgroundColor(ancestorStyle.get()))
1677 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); 1679 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor );
1678 } 1680 }
1679 return nullptr; 1681 return nullptr;
1680 } 1682 }
1681 1683
1682 } 1684 }
OLDNEW
« no previous file with comments | « LayoutTests/editing/deleting/merge-div-with-inline-style-expected.txt ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698