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