| OLD | NEW |
| 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 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 390 // Calculate cancel button's coordinates relative to the input element. | 390 // Calculate cancel button's coordinates relative to the input element. |
| 391 // Center the button vertically. Round up though, so if it has to be one pi
xel off-center, it will | 391 // Center the button vertically. Round up though, so if it has to be one pi
xel off-center, it will |
| 392 // be one pixel closer to the bottom of the field. This tends to look bette
r with the text. | 392 // be one pixel closer to the bottom of the field. This tends to look bette
r with the text. |
| 393 LayoutRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(
inputLayoutBox).width(), | 393 LayoutRect cancelButtonRect(cancelButtonObject->offsetFromAncestorContainer(
inputLayoutBox).width(), |
| 394 inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1)
/ 2, | 394 inputContentBox.y() + (inputContentBox.height() - cancelButtonSize + 1)
/ 2, |
| 395 cancelButtonSize, cancelButtonSize); | 395 cancelButtonSize, cancelButtonSize); |
| 396 IntRect paintingRect = convertToPaintingRect(inputLayoutBox, cancelButtonObj
ect, cancelButtonRect, r); | 396 IntRect paintingRect = convertToPaintingRect(inputLayoutBox, cancelButtonObj
ect, cancelButtonRect, r); |
| 397 | 397 |
| 398 DEFINE_STATIC_REF(Image, cancelImage, (Image::loadPlatformResource("searchCa
ncel"))); | 398 DEFINE_STATIC_REF(Image, cancelImage, (Image::loadPlatformResource("searchCa
ncel"))); |
| 399 DEFINE_STATIC_REF(Image, cancelPressedImage, (Image::loadPlatformResource("s
earchCancelPressed"))); | 399 DEFINE_STATIC_REF(Image, cancelPressedImage, (Image::loadPlatformResource("s
earchCancelPressed"))); |
| 400 paintInfo.context->drawImage(LayoutTheme::isPressed(cancelButtonObject) ? ca
ncelPressedImage : cancelImage, paintingRect); | 400 paintInfo.context->drawImage(LayoutTheme::isPressed(cancelButtonObject) ? ca
ncelPressedImage : cancelImage, paintingRect, KURL()); // TODO(davve): empty url |
| 401 return false; | 401 return false; |
| 402 } | 402 } |
| 403 | 403 |
| 404 bool ThemePainterDefault::paintSearchFieldResultsDecoration(LayoutObject* magnif
ierObject, const PaintInfo& paintInfo, const IntRect& r) | 404 bool ThemePainterDefault::paintSearchFieldResultsDecoration(LayoutObject* magnif
ierObject, const PaintInfo& paintInfo, const IntRect& r) |
| 405 { | 405 { |
| 406 // Get the layoutObject of <input> element. | 406 // Get the layoutObject of <input> element. |
| 407 if (!magnifierObject->node()) | 407 if (!magnifierObject->node()) |
| 408 return false; | 408 return false; |
| 409 Node* input = magnifierObject->node()->shadowHost(); | 409 Node* input = magnifierObject->node()->shadowHost(); |
| 410 LayoutObject* baseLayoutObject = input ? input->layoutObject() : magnifierOb
ject; | 410 LayoutObject* baseLayoutObject = input ? input->layoutObject() : magnifierOb
ject; |
| 411 if (!baseLayoutObject->isBox()) | 411 if (!baseLayoutObject->isBox()) |
| 412 return false; | 412 return false; |
| 413 LayoutBox* inputLayoutBox = toLayoutBox(baseLayoutObject); | 413 LayoutBox* inputLayoutBox = toLayoutBox(baseLayoutObject); |
| 414 LayoutRect inputContentBox = inputLayoutBox->contentBoxRect(); | 414 LayoutRect inputContentBox = inputLayoutBox->contentBoxRect(); |
| 415 | 415 |
| 416 // Make sure the scaled decoration stays square and will fit in its parent's
box. | 416 // Make sure the scaled decoration stays square and will fit in its parent's
box. |
| 417 LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<Layout
Unit>(inputContentBox.height(), r.height())); | 417 LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<Layout
Unit>(inputContentBox.height(), r.height())); |
| 418 // Calculate decoration's coordinates relative to the input element. | 418 // Calculate decoration's coordinates relative to the input element. |
| 419 // Center the decoration vertically. Round up though, so if it has to be on
e pixel off-center, it will | 419 // Center the decoration vertically. Round up though, so if it has to be on
e pixel off-center, it will |
| 420 // be one pixel closer to the bottom of the field. This tends to look bette
r with the text. | 420 // be one pixel closer to the bottom of the field. This tends to look bette
r with the text. |
| 421 LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputL
ayoutBox).width(), | 421 LayoutRect magnifierRect(magnifierObject->offsetFromAncestorContainer(inputL
ayoutBox).width(), |
| 422 inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2
, | 422 inputContentBox.y() + (inputContentBox.height() - magnifierSize + 1) / 2
, |
| 423 magnifierSize, magnifierSize); | 423 magnifierSize, magnifierSize); |
| 424 IntRect paintingRect = convertToPaintingRect(inputLayoutBox, magnifierObject
, magnifierRect, r); | 424 IntRect paintingRect = convertToPaintingRect(inputLayoutBox, magnifierObject
, magnifierRect, r); |
| 425 | 425 |
| 426 DEFINE_STATIC_REF(Image, magnifierImage, (Image::loadPlatformResource("searc
hMagnifier"))); | 426 DEFINE_STATIC_REF(Image, magnifierImage, (Image::loadPlatformResource("searc
hMagnifier"))); |
| 427 paintInfo.context->drawImage(magnifierImage, paintingRect); | 427 paintInfo.context->drawImage(magnifierImage, paintingRect, KURL()); // TODO(
davve): empty url |
| 428 return false; | 428 return false; |
| 429 } | 429 } |
| 430 | 430 |
| 431 } // namespace blink | 431 } // namespace blink |
| OLD | NEW |