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

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

Issue 281383006: Navigation transitions: Added createStyledMarkupForNavigationTransition (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Update from other review Created 6 years, 6 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 16 matching lines...) Expand all
27 #include "config.h" 27 #include "config.h"
28 #include "core/editing/EditingStyle.h" 28 #include "core/editing/EditingStyle.h"
29 29
30 #include "bindings/v8/ExceptionStatePlaceholder.h" 30 #include "bindings/v8/ExceptionStatePlaceholder.h"
31 #include "core/HTMLNames.h" 31 #include "core/HTMLNames.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"
42 #include "core/dom/Element.h" 43 #include "core/dom/Element.h"
43 #include "core/dom/Node.h" 44 #include "core/dom/Node.h"
44 #include "core/dom/NodeTraversal.h" 45 #include "core/dom/NodeTraversal.h"
45 #include "core/dom/Position.h" 46 #include "core/dom/Position.h"
46 #include "core/dom/QualifiedName.h" 47 #include "core/dom/QualifiedName.h"
47 #include "core/editing/ApplyStyleCommand.h" 48 #include "core/editing/ApplyStyleCommand.h"
48 #include "core/editing/Editor.h" 49 #include "core/editing/Editor.h"
49 #include "core/editing/FrameSelection.h" 50 #include "core/editing/FrameSelection.h"
50 #include "core/editing/HTMLInterchange.h" 51 #include "core/editing/HTMLInterchange.h"
51 #include "core/editing/htmlediting.h" 52 #include "core/editing/htmlediting.h"
52 #include "core/frame/LocalFrame.h" 53 #include "core/frame/LocalFrame.h"
53 #include "core/html/HTMLFontElement.h" 54 #include "core/html/HTMLFontElement.h"
55 #include "core/rendering/RenderBox.h"
56 #include "core/rendering/RenderObject.h"
54 #include "core/rendering/style/RenderStyle.h" 57 #include "core/rendering/style/RenderStyle.h"
55 58
56 namespace WebCore { 59 namespace WebCore {
57 60
58 static const CSSPropertyID& textDecorationPropertyForEditing() 61 static const CSSPropertyID& textDecorationPropertyForEditing()
59 { 62 {
60 static const CSSPropertyID property = RuntimeEnabledFeatures::css3TextDecora tionsEnabled() ? CSSPropertyTextDecorationLine : CSSPropertyTextDecoration; 63 static const CSSPropertyID property = RuntimeEnabledFeatures::css3TextDecora tionsEnabled() ? CSSPropertyTextDecorationLine : CSSPropertyTextDecoration;
61 return property; 64 return property;
62 } 65 }
63 66
(...skipping 1161 matching lines...) Expand 10 before | Expand all | Expand 10 after
1225 void EditingStyle::removePropertiesInElementDefaultStyle(Element* element) 1228 void EditingStyle::removePropertiesInElementDefaultStyle(Element* element)
1226 { 1229 {
1227 if (!m_mutableStyle || m_mutableStyle->isEmpty()) 1230 if (!m_mutableStyle || m_mutableStyle->isEmpty())
1228 return; 1231 return;
1229 1232
1230 RefPtr<StylePropertySet> defaultStyle = styleFromMatchedRulesForElement(elem ent, StyleResolver::UAAndUserCSSRules); 1233 RefPtr<StylePropertySet> defaultStyle = styleFromMatchedRulesForElement(elem ent, StyleResolver::UAAndUserCSSRules);
1231 1234
1232 removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get()); 1235 removePropertiesInStyle(m_mutableStyle.get(), defaultStyle.get());
1233 } 1236 }
1234 1237
1238 void EditingStyle::addAbsolutePositioningFromElement(const Element& element)
1239 {
1240 LayoutRect rect = element.boundingBox();
1241 RenderObject* renderer = element.renderer();
1242
1243 LayoutUnit x = rect.x();
1244 LayoutUnit y = rect.y();
1245 LayoutUnit width = rect.width();
1246 LayoutUnit height = rect.height();
1247 if (renderer && renderer->isBox()) {
1248 RenderBox* renderBox = toRenderBox(renderer);
1249
1250 x -= renderBox->marginLeft();
1251 y -= renderBox->marginTop();
1252
1253 m_mutableStyle->setProperty(CSSPropertyBoxSizing, CSSValueBorderBox);
esprehn 2014/06/26 09:32:55 The spec is going to have to be really clear about
1254 }
1255
1256 m_mutableStyle->setProperty(CSSPropertyPosition, CSSValueAbsolute);
1257 m_mutableStyle->setProperty(CSSPropertyLeft, cssValuePool().createValue(x, C SSPrimitiveValue::CSS_PX));
1258 m_mutableStyle->setProperty(CSSPropertyTop, cssValuePool().createValue(y, CS SPrimitiveValue::CSS_PX));
1259 m_mutableStyle->setProperty(CSSPropertyWidth, cssValuePool().createValue(wid th, CSSPrimitiveValue::CSS_PX));
1260 m_mutableStyle->setProperty(CSSPropertyHeight, cssValuePool().createValue(he ight, CSSPrimitiveValue::CSS_PX));
1261 }
1262
1235 void EditingStyle::forceInline() 1263 void EditingStyle::forceInline()
1236 { 1264 {
1237 if (!m_mutableStyle) 1265 if (!m_mutableStyle)
1238 m_mutableStyle = MutableStylePropertySet::create(); 1266 m_mutableStyle = MutableStylePropertySet::create();
1239 const bool propertyIsImportant = true; 1267 const bool propertyIsImportant = true;
1240 m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsIm portant); 1268 m_mutableStyle->setProperty(CSSPropertyDisplay, CSSValueInline, propertyIsIm portant);
1241 } 1269 }
1242 1270
1243 int EditingStyle::legacyFontSize(Document* document) const 1271 int EditingStyle::legacyFontSize(Document* document) const
1244 { 1272 {
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after
1660 { 1688 {
1661 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { 1689 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) {
1662 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor); 1690 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu tedStyleDeclaration::create(ancestor);
1663 if (!hasTransparentBackgroundColor(ancestorStyle.get())) 1691 if (!hasTransparentBackgroundColor(ancestorStyle.get()))
1664 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor ); 1692 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor );
1665 } 1693 }
1666 return nullptr; 1694 return nullptr;
1667 } 1695 }
1668 1696
1669 } 1697 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698