| 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 599 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 610 | 610 |
| 611 return pixelSnappedIntRect(partRect); | 611 return pixelSnappedIntRect(partRect); |
| 612 } | 612 } |
| 613 | 613 |
| 614 bool LayoutThemeDefault::paintSearchFieldCancelButton(LayoutObject* cancelButton
Object, const PaintInfo& paintInfo, const IntRect& r) | 614 bool LayoutThemeDefault::paintSearchFieldCancelButton(LayoutObject* cancelButton
Object, const PaintInfo& paintInfo, const IntRect& r) |
| 615 { | 615 { |
| 616 // Get the renderer of <input> element. | 616 // Get the renderer of <input> element. |
| 617 if (!cancelButtonObject->node()) | 617 if (!cancelButtonObject->node()) |
| 618 return false; | 618 return false; |
| 619 Node* input = cancelButtonObject->node()->shadowHost(); | 619 Node* input = cancelButtonObject->node()->shadowHost(); |
| 620 LayoutObject* baseRenderer = input ? input->renderer() : cancelButtonObject; | 620 LayoutObject* baseRenderer = input ? input->layoutObject() : cancelButtonObj
ect; |
| 621 if (!baseRenderer->isBox()) | 621 if (!baseRenderer->isBox()) |
| 622 return false; | 622 return false; |
| 623 LayoutBox* inputLayoutBox = toLayoutBox(baseRenderer); | 623 LayoutBox* inputLayoutBox = toLayoutBox(baseRenderer); |
| 624 LayoutRect inputContentBox = inputLayoutBox->contentBoxRect(); | 624 LayoutRect inputContentBox = inputLayoutBox->contentBoxRect(); |
| 625 | 625 |
| 626 // Make sure the scaled button stays square and will fit in its parent's box
. | 626 // Make sure the scaled button stays square and will fit in its parent's box
. |
| 627 LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min<Lay
outUnit>(inputContentBox.height(), r.height())); | 627 LayoutUnit cancelButtonSize = std::min(inputContentBox.width(), std::min<Lay
outUnit>(inputContentBox.height(), r.height())); |
| 628 // Calculate cancel button's coordinates relative to the input element. | 628 // Calculate cancel button's coordinates relative to the input element. |
| 629 // Center the button vertically. Round up though, so if it has to be one pi
xel off-center, it will | 629 // Center the button vertically. Round up though, so if it has to be one pi
xel off-center, it will |
| 630 // be one pixel closer to the bottom of the field. This tends to look bette
r with the text. | 630 // be one pixel closer to the bottom of the field. This tends to look bette
r with the text. |
| (...skipping 24 matching lines...) Expand all Loading... |
| 655 style.setWidth(Length(magnifierSize, Fixed)); | 655 style.setWidth(Length(magnifierSize, Fixed)); |
| 656 style.setHeight(Length(magnifierSize, Fixed)); | 656 style.setHeight(Length(magnifierSize, Fixed)); |
| 657 } | 657 } |
| 658 | 658 |
| 659 bool LayoutThemeDefault::paintSearchFieldResultsDecoration(LayoutObject* magnifi
erObject, const PaintInfo& paintInfo, const IntRect& r) | 659 bool LayoutThemeDefault::paintSearchFieldResultsDecoration(LayoutObject* magnifi
erObject, const PaintInfo& paintInfo, const IntRect& r) |
| 660 { | 660 { |
| 661 // Get the renderer of <input> element. | 661 // Get the renderer of <input> element. |
| 662 if (!magnifierObject->node()) | 662 if (!magnifierObject->node()) |
| 663 return false; | 663 return false; |
| 664 Node* input = magnifierObject->node()->shadowHost(); | 664 Node* input = magnifierObject->node()->shadowHost(); |
| 665 LayoutObject* baseRenderer = input ? input->renderer() : magnifierObject; | 665 LayoutObject* baseRenderer = input ? input->layoutObject() : magnifierObject
; |
| 666 if (!baseRenderer->isBox()) | 666 if (!baseRenderer->isBox()) |
| 667 return false; | 667 return false; |
| 668 LayoutBox* inputLayoutBox = toLayoutBox(baseRenderer); | 668 LayoutBox* inputLayoutBox = toLayoutBox(baseRenderer); |
| 669 LayoutRect inputContentBox = inputLayoutBox->contentBoxRect(); | 669 LayoutRect inputContentBox = inputLayoutBox->contentBoxRect(); |
| 670 | 670 |
| 671 // Make sure the scaled decoration stays square and will fit in its parent's
box. | 671 // Make sure the scaled decoration stays square and will fit in its parent's
box. |
| 672 LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<Layout
Unit>(inputContentBox.height(), r.height())); | 672 LayoutUnit magnifierSize = std::min(inputContentBox.width(), std::min<Layout
Unit>(inputContentBox.height(), r.height())); |
| 673 // Calculate decoration's coordinates relative to the input element. | 673 // Calculate decoration's coordinates relative to the input element. |
| 674 // Center the decoration vertically. Round up though, so if it has to be on
e pixel off-center, it will | 674 // Center the decoration vertically. Round up though, so if it has to be on
e pixel off-center, it will |
| 675 // be one pixel closer to the bottom of the field. This tends to look bette
r with the text. | 675 // be one pixel closer to the bottom of the field. This tends to look bette
r with the text. |
| (...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 862 } | 862 } |
| 863 | 863 |
| 864 LayoutThemeDefault::DirectionFlippingScope::~DirectionFlippingScope() | 864 LayoutThemeDefault::DirectionFlippingScope::~DirectionFlippingScope() |
| 865 { | 865 { |
| 866 if (!m_needsFlipping) | 866 if (!m_needsFlipping) |
| 867 return; | 867 return; |
| 868 m_paintInfo.context->restore(); | 868 m_paintInfo.context->restore(); |
| 869 } | 869 } |
| 870 | 870 |
| 871 } // namespace blink | 871 } // namespace blink |
| OLD | NEW |