Index: rendering/RenderThemeChromiumSkia.cpp |
=================================================================== |
--- rendering/RenderThemeChromiumSkia.cpp (revision 49502) |
+++ rendering/RenderThemeChromiumSkia.cpp (working copy) |
@@ -372,17 +372,28 @@ |
style->setHeight(Length(cancelButtonSize, Fixed)); |
} |
-bool RenderThemeChromiumSkia::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) |
+IntRect RenderThemeChromiumSkia::calculateParentBoxOfSearchFieldItem(RenderObject* o, const IntRect& r) |
{ |
- IntRect bounds = r; |
ASSERT(o->parent()); |
- if (!o->parent() || !o->parent()->isBox()) |
- return false; |
+ if (!o->isBox() || !o->parent() || !o->parent()->isBox()) |
+ return IntRect(); |
+ RenderBox* renderBox = toRenderBox(o); |
RenderBox* parentRenderBox = toRenderBox(o->parent()); |
- IntRect parentBox = parentRenderBox->absoluteContentBox(); |
+ IntPoint parentBoxPoint = r.location(); |
+ parentBoxPoint.move(-renderBox->x(), -renderBox->y()); // Restore parent box's location from r. |
+ IntRect parentBox(parentBoxPoint, parentRenderBox->contentBoxRect().size()); |
+ return parentBox; |
+} |
+bool RenderThemeChromiumSkia::paintSearchFieldCancelButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) |
+{ |
+ IntRect bounds = r; |
+ IntRect parentBox = calculateParentBoxOfSearchFieldItem(o, r); |
+ if (parentBox.isEmpty()) |
+ return false; |
+ |
// Make sure the scaled button stays square and will fit in its parent's box |
bounds.setHeight(std::min(parentBox.width(), std::min(parentBox.height(), bounds.height()))); |
bounds.setWidth(bounds.height()); |
@@ -417,13 +428,10 @@ |
bool RenderThemeChromiumSkia::paintSearchFieldResultsDecoration(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) |
{ |
IntRect bounds = r; |
- ASSERT(o->parent()); |
- if (!o->parent() || !o->parent()->isBox()) |
+ IntRect parentBox = calculateParentBoxOfSearchFieldItem(o, r); |
+ if (parentBox.isEmpty()) |
return false; |
- RenderBox* parentRenderBox = toRenderBox(o->parent()); |
- IntRect parentBox = parentRenderBox->absoluteContentBox(); |
- |
// Make sure the scaled decoration stays square and will fit in its parent's box |
bounds.setHeight(std::min(parentBox.width(), std::min(parentBox.height(), bounds.height()))); |
bounds.setWidth(bounds.height()); |
@@ -451,15 +459,10 @@ |
bool RenderThemeChromiumSkia::paintSearchFieldResultsButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) |
{ |
IntRect bounds = r; |
- ASSERT(o->parent()); |
- if (!o->parent()) |
+ IntRect parentBox = calculateParentBoxOfSearchFieldItem(o, r); |
+ if (parentBox.isEmpty()) |
return false; |
- if (!o->parent() || !o->parent()->isBox()) |
- return false; |
- RenderBox* parentRenderBox = toRenderBox(o->parent()); |
- IntRect parentBox = parentRenderBox->absoluteContentBox(); |
- |
// Make sure the scaled decoration will fit in its parent's box |
bounds.setHeight(std::min(parentBox.height(), bounds.height())); |
bounds.setWidth(std::min(parentBox.width(), static_cast<int>(bounds.height() * defaultSearchFieldResultsButtonWidth / defaultSearchFieldResultsDecorationSize))); |