OLD | NEW |
---|---|
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 16 matching lines...) Expand all Loading... | |
27 #include "config.h" | 27 #include "config.h" |
28 #include "core/editing/EditingStyle.h" | 28 #include "core/editing/EditingStyle.h" |
29 | 29 |
30 #include "HTMLNames.h" | 30 #include "HTMLNames.h" |
31 #include "bindings/v8/ExceptionStatePlaceholder.h" | 31 #include "bindings/v8/ExceptionStatePlaceholder.h" |
32 #include "core/css/CSSComputedStyleDeclaration.h" | 32 #include "core/css/CSSComputedStyleDeclaration.h" |
33 #include "core/css/parser/BisonCSSParser.h" | 33 #include "core/css/parser/BisonCSSParser.h" |
34 #include "core/css/CSSRuleList.h" | 34 #include "core/css/CSSRuleList.h" |
35 #include "core/css/CSSStyleRule.h" | 35 #include "core/css/CSSStyleRule.h" |
36 #include "core/css/CSSValueList.h" | 36 #include "core/css/CSSValueList.h" |
37 #include "core/css/CSSValuePool.h" | |
37 #include "core/css/FontSize.h" | 38 #include "core/css/FontSize.h" |
38 #include "core/css/RuntimeCSSEnabled.h" | 39 #include "core/css/RuntimeCSSEnabled.h" |
39 #include "core/css/StylePropertySet.h" | 40 #include "core/css/StylePropertySet.h" |
40 #include "core/css/StyleRule.h" | 41 #include "core/css/StyleRule.h" |
41 #include "core/css/resolver/StyleResolver.h" | 42 #include "core/css/resolver/StyleResolver.h" |
43 #include "core/dom/ClientRect.h" | |
42 #include "core/dom/Element.h" | 44 #include "core/dom/Element.h" |
43 #include "core/dom/Node.h" | 45 #include "core/dom/Node.h" |
44 #include "core/dom/NodeTraversal.h" | 46 #include "core/dom/NodeTraversal.h" |
45 #include "core/dom/Position.h" | 47 #include "core/dom/Position.h" |
46 #include "core/dom/QualifiedName.h" | 48 #include "core/dom/QualifiedName.h" |
47 #include "core/editing/ApplyStyleCommand.h" | 49 #include "core/editing/ApplyStyleCommand.h" |
48 #include "core/editing/Editor.h" | 50 #include "core/editing/Editor.h" |
49 #include "core/editing/FrameSelection.h" | 51 #include "core/editing/FrameSelection.h" |
50 #include "core/editing/HTMLInterchange.h" | 52 #include "core/editing/HTMLInterchange.h" |
51 #include "core/editing/htmlediting.h" | 53 #include "core/editing/htmlediting.h" |
(...skipping 1173 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1225 void EditingStyle::removePropertiesInElementDefaultStyle(Element* element) | 1227 void EditingStyle::removePropertiesInElementDefaultStyle(Element* element) |
1226 { | 1228 { |
1227 if (!m_mutableStyle || m_mutableStyle->isEmpty()) | 1229 if (!m_mutableStyle || m_mutableStyle->isEmpty()) |
1228 return; | 1230 return; |
1229 | 1231 |
1230 RefPtr<StylePropertySet> defaultStyle = styleFromMatchedRulesForElement(elem ent, StyleResolver::UAAndUserCSSRules); | 1232 RefPtr<StylePropertySet> defaultStyle = styleFromMatchedRulesForElement(elem ent, StyleResolver::UAAndUserCSSRules); |
1231 | 1233 |
1232 removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get()); | 1234 removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get()); |
1233 } | 1235 } |
1234 | 1236 |
1237 void EditingStyle::addAbsolutePositioningFromElement(Element* element) | |
1238 { | |
1239 RefPtr<ClientRect> rect = element->getBoundingClientRect(); | |
1240 | |
1241 m_mutableStyle->setProperty(CSSPropertyPosition, CSSValueAbsolute); | |
1242 m_mutableStyle->setProperty(CSSPropertyWidth, cssValuePool().createValue(rec t->right() - rect->left(), CSSPrimitiveValue::CSS_PX)); | |
1243 m_mutableStyle->setProperty(CSSPropertyHeight, cssValuePool().createValue(re ct->bottom() - rect->top(), CSSPrimitiveValue::CSS_PX)); | |
esprehn
2014/05/29 21:32:10
What about padding/margins? This approach doesn't
| |
1244 m_mutableStyle->setProperty(CSSPropertyLeft, cssValuePool().createValue(rect ->left(), CSSPrimitiveValue::CSS_PX)); | |
1245 m_mutableStyle->setProperty(CSSPropertyTop, cssValuePool().createValue(rect- >top(), CSSPrimitiveValue::CSS_PX)); | |
1246 } | |
1247 | |
1235 void EditingStyle::forceInline() | 1248 void EditingStyle::forceInline() |
1236 { | 1249 { |
1237 if (!m_mutableStyle) | 1250 if (!m_mutableStyle) |
1238 m_mutableStyle = MutableStylePropertySet::create(); | 1251 m_mutableStyle = MutableStylePropertySet::create(); |
1239 const bool propertyIsImportant = true; | 1252 const bool propertyIsImportant = true; |
1240 m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsIm portant); | 1253 m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsIm portant); |
1241 } | 1254 } |
1242 | 1255 |
1243 int EditingStyle::legacyFontSize(Document* document) const | 1256 int EditingStyle::legacyFontSize(Document* document) const |
1244 { | 1257 { |
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1655 { | 1668 { |
1656 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1669 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1657 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor); | 1670 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor); |
1658 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1671 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
1659 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); | 1672 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); |
1660 } | 1673 } |
1661 return nullptr; | 1674 return nullptr; |
1662 } | 1675 } |
1663 | 1676 |
1664 } | 1677 } |
OLD | NEW |