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

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

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 3 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/core/xml/parser/XMLDocumentParser.cpp ('k') | Source/web/ChromeClientImpl.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 /* 1 /*
2 * Copyright (C) 2011 Google Inc. All rights reserved. 2 * Copyright (C) 2011 Google Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions are 5 * modification, are permitted provided that the following conditions are
6 * met: 6 * met:
7 * 7 *
8 * * Redistributions of source code must retain the above copyright 8 * * 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 * * Redistributions in binary form must reproduce the above 10 * * Redistributions in binary form must reproduce the above
(...skipping 208 matching lines...) Expand 10 before | Expand all | Expand 10 after
219 return m_itemIDs[listIndex] == WebAutofillClient::MenuItemIDWarningMessage; 219 return m_itemIDs[listIndex] == WebAutofillClient::MenuItemIDWarningMessage;
220 } 220 }
221 221
222 void AutofillPopupMenuClient::setTextFromItem(unsigned listIndex) 222 void AutofillPopupMenuClient::setTextFromItem(unsigned listIndex)
223 { 223 {
224 m_textField->setValue(getSuggestion(listIndex)); 224 m_textField->setValue(getSuggestion(listIndex));
225 } 225 }
226 226
227 FontSelector* AutofillPopupMenuClient::fontSelector() const 227 FontSelector* AutofillPopupMenuClient::fontSelector() const
228 { 228 {
229 return m_textField->document()->styleResolver()->fontSelector(); 229 return m_textField->document().styleResolver()->fontSelector();
230 } 230 }
231 231
232 HostWindow* AutofillPopupMenuClient::hostWindow() const 232 HostWindow* AutofillPopupMenuClient::hostWindow() const
233 { 233 {
234 return m_textField->document()->view()->hostWindow(); 234 return m_textField->document().view()->hostWindow();
235 } 235 }
236 236
237 PassRefPtr<Scrollbar> AutofillPopupMenuClient::createScrollbar( 237 PassRefPtr<Scrollbar> AutofillPopupMenuClient::createScrollbar(
238 ScrollableArea* scrollableArea, 238 ScrollableArea* scrollableArea,
239 ScrollbarOrientation orientation, 239 ScrollbarOrientation orientation,
240 ScrollbarControlSize size) 240 ScrollbarControlSize size)
241 { 241 {
242 return Scrollbar::createNativeScrollbar(scrollableArea, orientation, size); 242 return Scrollbar::createNativeScrollbar(scrollableArea, orientation, size);
243 } 243 }
244 244
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
278 setSuggestions(namesWithSeparator, labelsWithSeparator, iconsWithSeparat or, itemIDsWithSeparator); 278 setSuggestions(namesWithSeparator, labelsWithSeparator, iconsWithSeparat or, itemIDsWithSeparator);
279 } 279 }
280 280
281 FontDescription regularFontDescription; 281 FontDescription regularFontDescription;
282 RenderTheme::theme().systemFont(CSSValueWebkitControl, 282 RenderTheme::theme().systemFont(CSSValueWebkitControl,
283 regularFontDescription); 283 regularFontDescription);
284 RenderStyle* style = m_textField->computedStyle(); 284 RenderStyle* style = m_textField->computedStyle();
285 regularFontDescription.setComputedSize(style->fontDescription().computedSize ()); 285 regularFontDescription.setComputedSize(style->fontDescription().computedSize ());
286 286
287 Font regularFont(regularFontDescription, 0, 0); 287 Font regularFont(regularFontDescription, 0, 0);
288 regularFont.update(textField->document()->styleResolver()->fontSelector()); 288 regularFont.update(textField->document().styleResolver()->fontSelector());
289 // The direction of text in popup menu is set the same as the direction of 289 // The direction of text in popup menu is set the same as the direction of
290 // the input element: textField. 290 // the input element: textField.
291 m_regularStyle = adoptPtr(new PopupMenuStyle(Color::black, Color::white, reg ularFont, true, false, 291 m_regularStyle = adoptPtr(new PopupMenuStyle(Color::black, Color::white, reg ularFont, true, false,
292 Length(WebCore::Fixed), textField->renderer()->style()->direction(), 292 Length(WebCore::Fixed), textField->renderer()->style()->direction(),
293 textField->renderer()->style()->unicodeBidi() == Override, 293 textField->renderer()->style()->unicodeBidi() == Override,
294 PopupMenuStyle::CustomBackgroundColor, PopupMenuStyle::AutofillPopup)); 294 PopupMenuStyle::CustomBackgroundColor, PopupMenuStyle::AutofillPopup));
295 295
296 FontDescription warningFontDescription = regularFont.fontDescription(); 296 FontDescription warningFontDescription = regularFont.fontDescription();
297 warningFontDescription.setItalic(true); 297 warningFontDescription.setItalic(true);
298 Font warningFont(warningFontDescription, regularFont.letterSpacing(), regula rFont.wordSpacing()); 298 Font warningFont(warningFontDescription, regularFont.letterSpacing(), regula rFont.wordSpacing());
(...skipping 25 matching lines...) Expand all
324 m_itemIDs.append(itemIDs[i]); 324 m_itemIDs.append(itemIDs[i]);
325 } 325 }
326 326
327 // Try to preserve selection if possible. 327 // Try to preserve selection if possible.
328 if (getSelectedIndex() >= static_cast<int>(names.size())) 328 if (getSelectedIndex() >= static_cast<int>(names.size()))
329 setSelectedIndex(-1); 329 setSelectedIndex(-1);
330 } 330 }
331 331
332 WebViewImpl* AutofillPopupMenuClient::getWebView() const 332 WebViewImpl* AutofillPopupMenuClient::getWebView() const
333 { 333 {
334 return WebViewImpl::fromPage(m_textField->document()->page()); 334 return WebViewImpl::fromPage(m_textField->document().page());
335 } 335 }
336 336
337 RenderStyle* AutofillPopupMenuClient::textFieldStyle() const 337 RenderStyle* AutofillPopupMenuClient::textFieldStyle() const
338 { 338 {
339 RenderStyle* style = m_textField->computedStyle(); 339 RenderStyle* style = m_textField->computedStyle();
340 if (!style) { 340 if (!style) {
341 // It seems we can only have a 0 style in a TextField if the 341 // It seems we can only have a 0 style in a TextField if the
342 // node is detached, in which case we the popup should not be 342 // node is detached, in which case we the popup should not be
343 // showing. Please report this in http://crbug.com/7708 and 343 // showing. Please report this in http://crbug.com/7708 and
344 // include the page you were visiting. 344 // include the page you were visiting.
345 ASSERT_NOT_REACHED(); 345 ASSERT_NOT_REACHED();
346 } 346 }
347 return style; 347 return style;
348 } 348 }
349 349
350 } // namespace WebKit 350 } // namespace WebKit
OLDNEW
« no previous file with comments | « Source/core/xml/parser/XMLDocumentParser.cpp ('k') | Source/web/ChromeClientImpl.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698