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

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, 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
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 1013 matching lines...) Expand 10 before | Expand all | Expand 10 after
1024 } 1024 }
1025 1025
1026 ASSERT_NOT_REACHED(); 1026 ASSERT_NOT_REACHED();
1027 return nullptr; 1027 return nullptr;
1028 } 1028 }
1029 1029
1030 void EditingStyle::mergeInlineAndImplicitStyleOfElement(Element* element, CSSPro pertyOverrideMode mode, PropertiesToInclude propertiesToInclude) 1030 void EditingStyle::mergeInlineAndImplicitStyleOfElement(Element* element, CSSPro pertyOverrideMode mode, PropertiesToInclude propertiesToInclude)
1031 { 1031 {
1032 RefPtr<EditingStyle> styleFromRules = EditingStyle::create(); 1032 RefPtr<EditingStyle> styleFromRules = EditingStyle::create();
1033 styleFromRules->mergeStyleFromRulesForSerialization(element); 1033 styleFromRules->mergeStyleFromRulesForSerialization(element);
1034
1035 if (element->inlineStyle())
1036 styleFromRules->m_mutableStyle->mergeAndOverrideOnConflict(element->inli neStyle());
1037
1034 styleFromRules->m_mutableStyle = extractEditingProperties(styleFromRules->m_ mutableStyle.get(), propertiesToInclude); 1038 styleFromRules->m_mutableStyle = extractEditingProperties(styleFromRules->m_ mutableStyle.get(), propertiesToInclude);
1035 mergeStyle(styleFromRules->m_mutableStyle.get(), mode); 1039 mergeStyle(styleFromRules->m_mutableStyle.get(), mode);
1036 1040
1037 mergeInlineStyleOfElement(element, mode, propertiesToInclude);
1038
1039 const WillBeHeapVector<OwnPtrWillBeMember<HTMLElementEquivalent> >& elementE quivalents = htmlElementEquivalents(); 1041 const WillBeHeapVector<OwnPtrWillBeMember<HTMLElementEquivalent> >& elementE quivalents = htmlElementEquivalents();
1040 for (size_t i = 0; i < elementEquivalents.size(); ++i) { 1042 for (size_t i = 0; i < elementEquivalents.size(); ++i) {
1041 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(elementEquivalents[i ].get(), element, mode, m_mutableStyle.get())) 1043 if (elementMatchesAndPropertyIsNotInInlineStyleDecl(elementEquivalents[i ].get(), element, mode, m_mutableStyle.get()))
1042 elementEquivalents[i]->addToStyle(element, this); 1044 elementEquivalents[i]->addToStyle(element, this);
1043 } 1045 }
1044 1046
1045 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent> >& attrib uteEquivalents = htmlAttributeEquivalents(); 1047 const WillBeHeapVector<OwnPtrWillBeMember<HTMLAttributeEquivalent> >& attrib uteEquivalents = htmlAttributeEquivalents();
1046 for (size_t i = 0; i < attributeEquivalents.size(); ++i) { 1048 for (size_t i = 0; i < attributeEquivalents.size(); ++i) {
1047 if (attributeEquivalents[i]->attributeName() == HTMLNames::dirAttr) 1049 if (attributeEquivalents[i]->attributeName() == HTMLNames::dirAttr)
1048 continue; // We don't want to include directionality 1050 continue; // We don't want to include directionality
(...skipping 606 matching lines...) Expand 10 before | Expand all | Expand 10 after
1655 { 1657 {
1656 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { 1658 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
1657 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl aration::create(ancestor); 1659 RefPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSComputedStyleDecl aration::create(ancestor);
1658 if (!hasTransparentBackgroundColor(ancestorStyle.get())) 1660 if (!hasTransparentBackgroundColor(ancestorStyle.get()))
1659 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); 1661 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor );
1660 } 1662 }
1661 return nullptr; 1663 return nullptr;
1662 } 1664 }
1663 1665
1664 } 1666 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698