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

Side by Side Diff: third_party/WebKit/Source/core/paint/ThemePainterDefault.cpp

Issue 2005093002: Remove non-standard 'results' attribute of INPUT element. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 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
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2007 Apple Inc. 2 * Copyright (C) 2007 Apple Inc.
3 * Copyright (C) 2007 Alp Toker <alp@atoker.com> 3 * Copyright (C) 2007 Alp Toker <alp@atoker.com>
4 * Copyright (C) 2008 Collabora Ltd. 4 * Copyright (C) 2008 Collabora Ltd.
5 * Copyright (C) 2008, 2009 Google Inc. 5 * Copyright (C) 2008, 2009 Google Inc.
6 * Copyright (C) 2009 Kenneth Rohde Christiansen 6 * Copyright (C) 2009 Kenneth Rohde Christiansen
7 * 7 *
8 * This library is free software; you can redistribute it and/or 8 * This library is free software; you can redistribute it and/or
9 * modify it under the terms of the GNU Library General Public 9 * modify it under the terms of the GNU Library General Public
10 * License as published by the Free Software Foundation; either 10 * License as published by the Free Software Foundation; either
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
391 inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2, 391 inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1) / 2,
392 cancelButtonSize, cancelButtonSize); 392 cancelButtonSize, cancelButtonSize);
393 IntRect paintingRect = convertToPaintingRect(inputLayoutBox, cancelButtonObj ect, cancelButtonRect, r); 393 IntRect paintingRect = convertToPaintingRect(inputLayoutBox, cancelButtonObj ect, cancelButtonRect, r);
394 394
395 DEFINE_STATIC_REF(Image, cancelImage, (Image::loadPlatformResource("searchCa ncel"))); 395 DEFINE_STATIC_REF(Image, cancelImage, (Image::loadPlatformResource("searchCa ncel")));
396 DEFINE_STATIC_REF(Image, cancelPressedImage, (Image::loadPlatformResource("s earchCancelPressed"))); 396 DEFINE_STATIC_REF(Image, cancelPressedImage, (Image::loadPlatformResource("s earchCancelPressed")));
397 paintInfo.context.drawImage(LayoutTheme::isPressed(cancelButtonObject) ? can celPressedImage : cancelImage, paintingRect); 397 paintInfo.context.drawImage(LayoutTheme::isPressed(cancelButtonObject) ? can celPressedImage : cancelImage, paintingRect);
398 return false; 398 return false;
399 } 399 }
400 400
401 bool ThemePainterDefault::paintSearchFieldResultsDecoration(const LayoutObject& magnifierObject, const PaintInfo& paintInfo, const IntRect& r)
402 {
403 // Get the layoutObject of <input> element.
404 if (!magnifierObject.node())
405 return false;
406 Node* input = magnifierObject.node()->shadowHost();
407 const LayoutObject& baseLayoutObject = input ? *input->layoutObject() : magn ifierObject;
408 if (!baseLayoutObject.isBox())
409 return false;
410 const LayoutBox& inputLayoutBox = toLayoutBox(baseLayoutObject);
411 LayoutRect inputContentBox = inputLayoutBox.contentBoxRect();
412
413 // Make sure the scaled decoration stays square and will fit in its parent's box.
414 LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min(inputC ontentBox.height(), LayoutUnit(r.height())));
415 // Calculate decoration's coordinates relative to the input element.
416 // Center the decoration vertically. Round up though, so if it has to be on e pixel off-center, it will
417 // be one pixel closer to the bottom of the field. This tends to look bette r with the text.
418 LayoutRect magnifierRect(magnifierObject.offsetFromAncestorContainer(&inputL ayoutBox).width(),
419 inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2 ,
420 magnifierSize, magnifierSize);
421 IntRect paintingRect = convertToPaintingRect(inputLayoutBox, magnifierObject , magnifierRect, r);
422
423 DEFINE_STATIC_REF(Image, magnifierImage, (Image::loadPlatformResource("searc hMagnifier")));
424 paintInfo.context.drawImage(magnifierImage, paintingRect);
425 return false;
426 }
427
428 } // namespace blink 401 } // namespace blink
OLDNEW
« no previous file with comments | « third_party/WebKit/Source/core/paint/ThemePainterDefault.h ('k') | third_party/WebKit/Source/core/paint/ThemePainterMac.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698