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 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 #include "core/dom/Position.h" | 47 #include "core/dom/Position.h" |
48 #include "core/dom/QualifiedName.h" | 48 #include "core/dom/QualifiedName.h" |
49 #include "core/editing/ApplyStyleCommand.h" | 49 #include "core/editing/ApplyStyleCommand.h" |
50 #include "core/editing/Editor.h" | 50 #include "core/editing/Editor.h" |
51 #include "core/editing/FrameSelection.h" | 51 #include "core/editing/FrameSelection.h" |
52 #include "core/editing/HTMLInterchange.h" | 52 #include "core/editing/HTMLInterchange.h" |
53 #include "core/editing/htmlediting.h" | 53 #include "core/editing/htmlediting.h" |
54 #include "core/frame/LocalFrame.h" | 54 #include "core/frame/LocalFrame.h" |
55 #include "core/html/HTMLFontElement.h" | 55 #include "core/html/HTMLFontElement.h" |
56 #include "core/html/HTMLSpanElement.h" | 56 #include "core/html/HTMLSpanElement.h" |
| 57 #include "core/layout/LayoutBox.h" |
57 #include "core/layout/LayoutObject.h" | 58 #include "core/layout/LayoutObject.h" |
58 #include "core/layout/style/LayoutStyle.h" | 59 #include "core/layout/style/LayoutStyle.h" |
59 #include "core/rendering/RenderBox.h" | |
60 | 60 |
61 namespace blink { | 61 namespace blink { |
62 | 62 |
63 static const CSSPropertyID& textDecorationPropertyForEditing() | 63 static const CSSPropertyID& textDecorationPropertyForEditing() |
64 { | 64 { |
65 static const CSSPropertyID property = RuntimeEnabledFeatures::css3TextDecora
tionsEnabled() ? CSSPropertyTextDecorationLine : CSSPropertyTextDecoration; | 65 static const CSSPropertyID property = RuntimeEnabledFeatures::css3TextDecora
tionsEnabled() ? CSSPropertyTextDecorationLine : CSSPropertyTextDecoration; |
66 return property; | 66 return property; |
67 } | 67 } |
68 | 68 |
69 // Editing style properties must be preserved during editing operation. | 69 // Editing style properties must be preserved during editing operation. |
(...skipping 1164 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1234 void EditingStyle::addAbsolutePositioningFromElement(const Element& element) | 1234 void EditingStyle::addAbsolutePositioningFromElement(const Element& element) |
1235 { | 1235 { |
1236 LayoutRect rect = element.boundingBox(); | 1236 LayoutRect rect = element.boundingBox(); |
1237 LayoutObject* renderer = element.renderer(); | 1237 LayoutObject* renderer = element.renderer(); |
1238 | 1238 |
1239 LayoutUnit x = rect.x(); | 1239 LayoutUnit x = rect.x(); |
1240 LayoutUnit y = rect.y(); | 1240 LayoutUnit y = rect.y(); |
1241 LayoutUnit width = rect.width(); | 1241 LayoutUnit width = rect.width(); |
1242 LayoutUnit height = rect.height(); | 1242 LayoutUnit height = rect.height(); |
1243 if (renderer && renderer->isBox()) { | 1243 if (renderer && renderer->isBox()) { |
1244 RenderBox* renderBox = toRenderBox(renderer); | 1244 LayoutBox* layoutBox = toLayoutBox(renderer); |
1245 | 1245 |
1246 x -= renderBox->marginLeft(); | 1246 x -= layoutBox->marginLeft(); |
1247 y -= renderBox->marginTop(); | 1247 y -= layoutBox->marginTop(); |
1248 | 1248 |
1249 m_mutableStyle->setProperty(CSSPropertyBoxSizing, CSSValueBorderBox); | 1249 m_mutableStyle->setProperty(CSSPropertyBoxSizing, CSSValueBorderBox); |
1250 } | 1250 } |
1251 | 1251 |
1252 m_mutableStyle->setProperty(CSSPropertyPosition, CSSValueAbsolute); | 1252 m_mutableStyle->setProperty(CSSPropertyPosition, CSSValueAbsolute); |
1253 m_mutableStyle->setProperty(CSSPropertyLeft, cssValuePool().createValue(x, C
SSPrimitiveValue::CSS_PX)); | 1253 m_mutableStyle->setProperty(CSSPropertyLeft, cssValuePool().createValue(x, C
SSPrimitiveValue::CSS_PX)); |
1254 m_mutableStyle->setProperty(CSSPropertyTop, cssValuePool().createValue(y, CS
SPrimitiveValue::CSS_PX)); | 1254 m_mutableStyle->setProperty(CSSPropertyTop, cssValuePool().createValue(y, CS
SPrimitiveValue::CSS_PX)); |
1255 m_mutableStyle->setProperty(CSSPropertyWidth, cssValuePool().createValue(wid
th, CSSPrimitiveValue::CSS_PX)); | 1255 m_mutableStyle->setProperty(CSSPropertyWidth, cssValuePool().createValue(wid
th, CSSPrimitiveValue::CSS_PX)); |
1256 m_mutableStyle->setProperty(CSSPropertyHeight, cssValuePool().createValue(he
ight, CSSPrimitiveValue::CSS_PX)); | 1256 m_mutableStyle->setProperty(CSSPropertyHeight, cssValuePool().createValue(he
ight, CSSPrimitiveValue::CSS_PX)); |
1257 } | 1257 } |
(...skipping 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1678 { | 1678 { |
1679 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { | 1679 for (Node* ancestor = node; ancestor; ancestor = ancestor->parentNode()) { |
1680 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); | 1680 RefPtrWillBeRawPtr<CSSComputedStyleDeclaration> ancestorStyle = CSSCompu
tedStyleDeclaration::create(ancestor); |
1681 if (!hasTransparentBackgroundColor(ancestorStyle.get())) | 1681 if (!hasTransparentBackgroundColor(ancestorStyle.get())) |
1682 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); | 1682 return ancestorStyle->getPropertyCSSValue(CSSPropertyBackgroundColor
); |
1683 } | 1683 } |
1684 return nullptr; | 1684 return nullptr; |
1685 } | 1685 } |
1686 | 1686 |
1687 } | 1687 } |
OLD | NEW |