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

Side by Side Diff: Source/web/PopupMenuImpl.cpp

Issue 1033943002: Rename LayoutStyle to papayawhip (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: ensureComputedStyle Created 5 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « Source/web/FindInPageCoordinates.cpp ('k') | Source/web/PopupMenuTest.cpp » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "config.h" 5 #include "config.h"
6 #include "web/PopupMenuImpl.h" 6 #include "web/PopupMenuImpl.h"
7 7
8 #include "core/HTMLNames.h" 8 #include "core/HTMLNames.h"
9 #include "core/css/CSSFontSelector.h" 9 #include "core/css/CSSFontSelector.h"
10 #include "core/dom/ElementTraversal.h" 10 #include "core/dom/ElementTraversal.h"
11 #include "core/dom/NodeLayoutStyle.h" 11 #include "core/dom/NodeComputedStyle.h"
12 #include "core/dom/StyleEngine.h" 12 #include "core/dom/StyleEngine.h"
13 #include "core/frame/FrameView.h" 13 #include "core/frame/FrameView.h"
14 #include "core/html/HTMLHRElement.h" 14 #include "core/html/HTMLHRElement.h"
15 #include "core/html/HTMLOptGroupElement.h" 15 #include "core/html/HTMLOptGroupElement.h"
16 #include "core/html/HTMLOptionElement.h" 16 #include "core/html/HTMLOptionElement.h"
17 #include "core/html/parser/HTMLParserIdioms.h" 17 #include "core/html/parser/HTMLParserIdioms.h"
18 #include "core/layout/LayoutTheme.h" 18 #include "core/layout/LayoutTheme.h"
19 #include "core/page/PagePopup.h" 19 #include "core/page/PagePopup.h"
20 #include "platform/geometry/IntRect.h" 20 #include "platform/geometry/IntRect.h"
21 #include "platform/text/PlatformLocale.h" 21 #include "platform/text/PlatformLocale.h"
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 for (HTMLElement& child : Traversal<HTMLElement>::childrenOf(ownerElement()) ) { 96 for (HTMLElement& child : Traversal<HTMLElement>::childrenOf(ownerElement()) ) {
97 if (isHTMLOptionElement(child)) 97 if (isHTMLOptionElement(child))
98 addOption(toHTMLOptionElement(child), data); 98 addOption(toHTMLOptionElement(child), data);
99 if (isHTMLOptGroupElement(child)) 99 if (isHTMLOptGroupElement(child))
100 addOptGroup(toHTMLOptGroupElement(child), data); 100 addOptGroup(toHTMLOptGroupElement(child), data);
101 if (isHTMLHRElement(child)) 101 if (isHTMLHRElement(child))
102 addSeparator(toHTMLHRElement(child), data); 102 addSeparator(toHTMLHRElement(child), data);
103 } 103 }
104 PagePopupClient::addString("],\n", data); 104 PagePopupClient::addString("],\n", data);
105 addProperty("anchorRectInScreen", anchorRectInScreen, data); 105 addProperty("anchorRectInScreen", anchorRectInScreen, data);
106 const LayoutStyle* ownerStyle = ownerElement().layoutStyle(); 106 const ComputedStyle* ownerStyle = ownerElement().computedStyle();
107 Color backgroundColor = ownerStyle->visitedDependentColor(CSSPropertyBackgro undColor); 107 Color backgroundColor = ownerStyle->visitedDependentColor(CSSPropertyBackgro undColor);
108 #if OS(LINUX) 108 #if OS(LINUX)
109 // On other platforms, the <option> background color is the same as the 109 // On other platforms, the <option> background color is the same as the
110 // <select> background color. On Linux, that makes the <option> 110 // <select> background color. On Linux, that makes the <option>
111 // background color very dark, so by default, try to use a lighter 111 // background color very dark, so by default, try to use a lighter
112 // background color for <option>s. 112 // background color for <option>s.
113 if (LayoutTheme::theme().systemColor(CSSValueButtonface) == backgroundColor) 113 if (LayoutTheme::theme().systemColor(CSSValueButtonface) == backgroundColor)
114 backgroundColor = LayoutTheme::theme().systemColor(CSSValueMenu); 114 backgroundColor = LayoutTheme::theme().systemColor(CSSValueMenu);
115 #endif 115 #endif
116 addProperty("backgroundColor", backgroundColor.serialized(), data); 116 addProperty("backgroundColor", backgroundColor.serialized(), data);
(...skipping 30 matching lines...) Expand all
147 return "900"; 147 return "900";
148 default: 148 default:
149 ASSERT_NOT_REACHED(); 149 ASSERT_NOT_REACHED();
150 break; 150 break;
151 } 151 }
152 return 0; 152 return 0;
153 } 153 }
154 154
155 void PopupMenuImpl::addElementStyle(HTMLElement& element, SharedBuffer* data) 155 void PopupMenuImpl::addElementStyle(HTMLElement& element, SharedBuffer* data)
156 { 156 {
157 const LayoutStyle* style = m_client->layoutStyleForItem(element); 157 const ComputedStyle* style = m_client->computedStyleForItem(element);
158 ASSERT(style); 158 ASSERT(style);
159 PagePopupClient::addString("style: {\n", data); 159 PagePopupClient::addString("style: {\n", data);
160 addProperty("color", style->visitedDependentColor(CSSPropertyColor).serializ ed(), data); 160 addProperty("color", style->visitedDependentColor(CSSPropertyColor).serializ ed(), data);
161 addProperty("backgroundColor", style->visitedDependentColor(CSSPropertyBackg roundColor).serialized(), data); 161 addProperty("backgroundColor", style->visitedDependentColor(CSSPropertyBackg roundColor).serialized(), data);
162 const FontDescription& fontDescription = style->font().fontDescription(); 162 const FontDescription& fontDescription = style->font().fontDescription();
163 addProperty("fontSize", fontDescription.computedPixelSize(), data); 163 addProperty("fontSize", fontDescription.computedPixelSize(), data);
164 addProperty("fontWeight", String(fontWeightToString(fontDescription.weight() )), data); 164 addProperty("fontWeight", String(fontWeightToString(fontDescription.weight() )), data);
165 PagePopupClient::addString("fontFamily: [\n", data); 165 PagePopupClient::addString("fontFamily: [\n", data);
166 for (const FontFamily* f = &fontDescription.family(); f; f = f->next()) { 166 for (const FontFamily* f = &fontDescription.family(); f; f = f->next()) {
167 addJavaScriptString(f->family().string(), data); 167 addJavaScriptString(f->family().string(), data);
(...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after
323 323
324 void PopupMenuImpl::disconnectClient() 324 void PopupMenuImpl::disconnectClient()
325 { 325 {
326 m_client = nullptr; 326 m_client = nullptr;
327 // Cannot be done during finalization, so instead done when the 327 // Cannot be done during finalization, so instead done when the
328 // render object is destroyed and disconnected. 328 // render object is destroyed and disconnected.
329 dispose(); 329 dispose();
330 } 330 }
331 331
332 } // namespace blink 332 } // namespace blink
OLDNEW
« no previous file with comments | « Source/web/FindInPageCoordinates.cpp ('k') | Source/web/PopupMenuTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698