| OLD | NEW |
| 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2014 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "web/PopupMenuImpl.h" | 5 #include "web/PopupMenuImpl.h" |
| 6 | 6 |
| 7 #include "core/HTMLNames.h" | 7 #include "core/HTMLNames.h" |
| 8 #include "core/css/CSSFontSelector.h" | 8 #include "core/css/CSSFontSelector.h" |
| 9 #include "core/dom/ElementTraversal.h" | 9 #include "core/dom/ElementTraversal.h" |
| 10 #include "core/dom/ExecutionContextTask.h" | 10 #include "core/dom/ExecutionContextTask.h" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 67 return "oblique"; | 67 return "oblique"; |
| 68 case FontStyleItalic: | 68 case FontStyleItalic: |
| 69 return "italic"; | 69 return "italic"; |
| 70 } | 70 } |
| 71 NOTREACHED(); | 71 NOTREACHED(); |
| 72 return nullptr; | 72 return nullptr; |
| 73 } | 73 } |
| 74 | 74 |
| 75 const char* textTransformToString(ETextTransform transform) { | 75 const char* textTransformToString(ETextTransform transform) { |
| 76 switch (transform) { | 76 switch (transform) { |
| 77 case ETextTransform::Capitalize: | 77 case ETextTransform::kCapitalize: |
| 78 return "capitalize"; | 78 return "capitalize"; |
| 79 case ETextTransform::Uppercase: | 79 case ETextTransform::kUppercase: |
| 80 return "uppercase"; | 80 return "uppercase"; |
| 81 case ETextTransform::Lowercase: | 81 case ETextTransform::kLowercase: |
| 82 return "lowercase"; | 82 return "lowercase"; |
| 83 case ETextTransform::None: | 83 case ETextTransform::kNone: |
| 84 return "none"; | 84 return "none"; |
| 85 } | 85 } |
| 86 NOTREACHED(); | 86 NOTREACHED(); |
| 87 return ""; | 87 return ""; |
| 88 } | 88 } |
| 89 | 89 |
| 90 } // anonymous namespace | 90 } // anonymous namespace |
| 91 | 91 |
| 92 class PopupMenuCSSFontSelector : public CSSFontSelector, | 92 class PopupMenuCSSFontSelector : public CSSFontSelector, |
| 93 private CSSFontSelectorClient { | 93 private CSSFontSelectorClient { |
| (...skipping 214 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 308 } | 308 } |
| 309 | 309 |
| 310 void PopupMenuImpl::addElementStyle(ItemIterationContext& context, | 310 void PopupMenuImpl::addElementStyle(ItemIterationContext& context, |
| 311 HTMLElement& element) { | 311 HTMLElement& element) { |
| 312 const ComputedStyle* style = m_ownerElement->itemComputedStyle(element); | 312 const ComputedStyle* style = m_ownerElement->itemComputedStyle(element); |
| 313 DCHECK(style); | 313 DCHECK(style); |
| 314 SharedBuffer* data = context.m_buffer; | 314 SharedBuffer* data = context.m_buffer; |
| 315 // TODO(tkent): We generate unnecessary "style: {\n},\n" even if no | 315 // TODO(tkent): We generate unnecessary "style: {\n},\n" even if no |
| 316 // additional style. | 316 // additional style. |
| 317 PagePopupClient::addString("style: {\n", data); | 317 PagePopupClient::addString("style: {\n", data); |
| 318 if (style->visibility() == EVisibility::Hidden) | 318 if (style->visibility() == EVisibility::kHidden) |
| 319 addProperty("visibility", String("hidden"), data); | 319 addProperty("visibility", String("hidden"), data); |
| 320 if (style->display() == EDisplay::None) | 320 if (style->display() == EDisplay::None) |
| 321 addProperty("display", String("none"), data); | 321 addProperty("display", String("none"), data); |
| 322 const ComputedStyle& baseStyle = context.baseStyle(); | 322 const ComputedStyle& baseStyle = context.baseStyle(); |
| 323 if (baseStyle.direction() != style->direction()) { | 323 if (baseStyle.direction() != style->direction()) { |
| 324 addProperty( | 324 addProperty( |
| 325 "direction", | 325 "direction", |
| 326 String(style->direction() == TextDirection::Rtl ? "rtl" : "ltr"), data); | 326 String(style->direction() == TextDirection::kRtl ? "rtl" : "ltr"), |
| 327 data); |
| 327 } | 328 } |
| 328 if (isOverride(style->unicodeBidi())) | 329 if (isOverride(style->unicodeBidi())) |
| 329 addProperty("unicodeBidi", String("bidi-override"), data); | 330 addProperty("unicodeBidi", String("bidi-override"), data); |
| 330 Color foregroundColor = style->visitedDependentColor(CSSPropertyColor); | 331 Color foregroundColor = style->visitedDependentColor(CSSPropertyColor); |
| 331 if (baseStyle.visitedDependentColor(CSSPropertyColor) != foregroundColor) | 332 if (baseStyle.visitedDependentColor(CSSPropertyColor) != foregroundColor) |
| 332 addProperty("color", foregroundColor.serialized(), data); | 333 addProperty("color", foregroundColor.serialized(), data); |
| 333 Color backgroundColor = | 334 Color backgroundColor = |
| 334 style->visitedDependentColor(CSSPropertyBackgroundColor); | 335 style->visitedDependentColor(CSSPropertyBackgroundColor); |
| 335 if (context.backgroundColor() != backgroundColor && | 336 if (context.backgroundColor() != backgroundColor && |
| 336 backgroundColor != Color::transparent) | 337 backgroundColor != Color::transparent) |
| (...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 553 } | 554 } |
| 554 | 555 |
| 555 void PopupMenuImpl::disconnectClient() { | 556 void PopupMenuImpl::disconnectClient() { |
| 556 m_ownerElement = nullptr; | 557 m_ownerElement = nullptr; |
| 557 // Cannot be done during finalization, so instead done when the | 558 // Cannot be done during finalization, so instead done when the |
| 558 // layout object is destroyed and disconnected. | 559 // layout object is destroyed and disconnected. |
| 559 dispose(); | 560 dispose(); |
| 560 } | 561 } |
| 561 | 562 |
| 562 } // namespace blink | 563 } // namespace blink |
| OLD | NEW |