| 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 187 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 PagePopupClient::addString(",", m_buffer); | 198 PagePopupClient::addString(",", m_buffer); |
| 199 } | 199 } |
| 200 PagePopupClient::addString("]", m_buffer); | 200 PagePopupClient::addString("]", m_buffer); |
| 201 PagePopupClient::addString("},\n", m_buffer); | 201 PagePopupClient::addString("},\n", m_buffer); |
| 202 } | 202 } |
| 203 | 203 |
| 204 Color backgroundColor() const { return m_isInGroup ? m_groupStyle->visitedDe
pendentColor(CSSPropertyBackgroundColor) : m_backgroundColor; } | 204 Color backgroundColor() const { return m_isInGroup ? m_groupStyle->visitedDe
pendentColor(CSSPropertyBackgroundColor) : m_backgroundColor; } |
| 205 // Do not use baseStyle() for background-color, use backgroundColor() | 205 // Do not use baseStyle() for background-color, use backgroundColor() |
| 206 // instead. | 206 // instead. |
| 207 const ComputedStyle& baseStyle() { return m_isInGroup ? *m_groupStyle : m_ba
seStyle; } | 207 const ComputedStyle& baseStyle() { return m_isInGroup ? *m_groupStyle : m_ba
seStyle; } |
| 208 const FontDescription& baseFont() { return m_isInGroup ? m_groupStyle->fontD
escription() : m_baseStyle.fontDescription(); } | 208 const FontDescription& baseFont() { return m_isInGroup ? m_groupStyle->getFo
ntDescription() : m_baseStyle.getFontDescription(); } |
| 209 void startGroupChildren(const ComputedStyle& groupStyle) | 209 void startGroupChildren(const ComputedStyle& groupStyle) |
| 210 { | 210 { |
| 211 ASSERT(!m_isInGroup); | 211 ASSERT(!m_isInGroup); |
| 212 PagePopupClient::addString("children: [", m_buffer); | 212 PagePopupClient::addString("children: [", m_buffer); |
| 213 m_isInGroup = true; | 213 m_isInGroup = true; |
| 214 m_groupStyle = &groupStyle; | 214 m_groupStyle = &groupStyle; |
| 215 } | 215 } |
| 216 void finishGroupIfNecessary() | 216 void finishGroupIfNecessary() |
| 217 { | 217 { |
| 218 if (!m_isInGroup) | 218 if (!m_isInGroup) |
| (...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 318 addProperty("direction", String(style->direction() == RTL ? "rtl" : "ltr
"), data); | 318 addProperty("direction", String(style->direction() == RTL ? "rtl" : "ltr
"), data); |
| 319 if (isOverride(style->unicodeBidi())) | 319 if (isOverride(style->unicodeBidi())) |
| 320 addProperty("unicodeBidi", String("bidi-override"), data); | 320 addProperty("unicodeBidi", String("bidi-override"), data); |
| 321 Color foregroundColor = style->visitedDependentColor(CSSPropertyColor); | 321 Color foregroundColor = style->visitedDependentColor(CSSPropertyColor); |
| 322 if (baseStyle.visitedDependentColor(CSSPropertyColor) != foregroundColor) | 322 if (baseStyle.visitedDependentColor(CSSPropertyColor) != foregroundColor) |
| 323 addProperty("color", foregroundColor.serialized(), data); | 323 addProperty("color", foregroundColor.serialized(), data); |
| 324 Color backgroundColor = style->visitedDependentColor(CSSPropertyBackgroundCo
lor); | 324 Color backgroundColor = style->visitedDependentColor(CSSPropertyBackgroundCo
lor); |
| 325 if (context.backgroundColor() != backgroundColor && backgroundColor != Color
::transparent) | 325 if (context.backgroundColor() != backgroundColor && backgroundColor != Color
::transparent) |
| 326 addProperty("backgroundColor", backgroundColor.serialized(), data); | 326 addProperty("backgroundColor", backgroundColor.serialized(), data); |
| 327 const FontDescription& baseFont = context.baseFont(); | 327 const FontDescription& baseFont = context.baseFont(); |
| 328 const FontDescription& fontDescription = style->font().fontDescription(); | 328 const FontDescription& fontDescription = style->font().getFontDescription(); |
| 329 if (baseFont.computedPixelSize() != fontDescription.computedPixelSize()) { | 329 if (baseFont.computedPixelSize() != fontDescription.computedPixelSize()) { |
| 330 // We don't use FontDescription::specifiedSize() because this element | 330 // We don't use FontDescription::specifiedSize() because this element |
| 331 // might have its own zoom level. | 331 // might have its own zoom level. |
| 332 addProperty("fontSize", fontDescription.computedSize() / zoomFactor(), d
ata); | 332 addProperty("fontSize", fontDescription.computedSize() / zoomFactor(), d
ata); |
| 333 } | 333 } |
| 334 // Our UA stylesheet has font-weight:normal for OPTION. | 334 // Our UA stylesheet has font-weight:normal for OPTION. |
| 335 if (FontWeightNormal != fontDescription.weight()) | 335 if (FontWeightNormal != fontDescription.weight()) |
| 336 addProperty("fontWeight", String(fontWeightToString(fontDescription.weig
ht())), data); | 336 addProperty("fontWeight", String(fontWeightToString(fontDescription.weig
ht())), data); |
| 337 if (baseFont.family() != fontDescription.family()) { | 337 if (baseFont.family() != fontDescription.family()) { |
| 338 PagePopupClient::addString("fontFamily: [\n", data); | 338 PagePopupClient::addString("fontFamily: [\n", data); |
| (...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 535 | 535 |
| 536 void PopupMenuImpl::disconnectClient() | 536 void PopupMenuImpl::disconnectClient() |
| 537 { | 537 { |
| 538 m_ownerElement = nullptr; | 538 m_ownerElement = nullptr; |
| 539 // Cannot be done during finalization, so instead done when the | 539 // Cannot be done during finalization, so instead done when the |
| 540 // layout object is destroyed and disconnected. | 540 // layout object is destroyed and disconnected. |
| 541 dispose(); | 541 dispose(); |
| 542 } | 542 } |
| 543 | 543 |
| 544 } // namespace blink | 544 } // namespace blink |
| OLD | NEW |