Commit b195fcd2 authored by malaykeshav's avatar malaykeshav Committed by Commit bot

Modifies the logic to compute the dimensions of the drop down menu

arrow that is used in layout tests. This modification allows the
arrow to look the right size in different device scale factors when
using zoom-for-dsf. This is achieved by using a square drop down
arrow instead of a rectangular one. This logic is similar to what
the native theme engine uses.

BUG=640256
COMPONENT=Test Runners, Mock Web Theme Engine
CQ_INCLUDE_TRYBOTS=master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2

Review-Url: https://codereview.chromium.org/2340633002
Cr-Commit-Position: refs/heads/master@{#419930}
parent 0c474f48
...@@ -482,24 +482,26 @@ void MockWebThemeEngine::paint(blink::WebCanvas* canvas, ...@@ -482,24 +482,26 @@ void MockWebThemeEngine::paint(blink::WebCanvas* canvas,
} }
// clip the drop-down arrow to be inside the select box // clip the drop-down arrow to be inside the select box
if (extraParams->menuList.arrowX - 4 > irect.fLeft) irect.fLeft =
irect.fLeft = extraParams->menuList.arrowX - 4; std::max(irect.fLeft, extraParams->menuList.arrowX -
if (extraParams->menuList.arrowX + 12 < irect.fRight) (extraParams->menuList.arrowSize + 1) / 2);
irect.fRight = extraParams->menuList.arrowX + 12; irect.fRight =
std::min(irect.fLeft + extraParams->menuList.arrowSize, irect.fRight);
irect.fTop = extraParams->menuList.arrowY - irect.fTop = extraParams->menuList.arrowY -
(extraParams->menuList.arrowSize) / 2; (extraParams->menuList.arrowSize) / 2;
irect.fBottom = extraParams->menuList.arrowY + irect.fBottom = irect.fTop + (extraParams->menuList.arrowSize);
(extraParams->menuList.arrowSize - 1) / 2;
halfWidth = irect.width() / 2; halfWidth = irect.width() / 2;
quarterWidth = irect.width() / 4; quarterWidth = irect.width() / 4;
if (state == WebThemeEngine::StateFocused) // FIXME: draw differenty? if (state == WebThemeEngine::StateFocused) // FIXME: draw differenty?
state = WebThemeEngine::StateNormal; state = WebThemeEngine::StateNormal;
box(canvas, irect, bgColors(state)); box(canvas, irect, bgColors(state));
triangle(canvas, irect.fLeft + quarterWidth, irect.fTop, triangle(canvas, irect.fLeft + quarterWidth, irect.fTop + quarterWidth,
irect.fRight - quarterWidth, irect.fTop, irect.fLeft + halfWidth, irect.fRight - quarterWidth, irect.fTop + quarterWidth,
irect.fBottom, edgeColor); irect.fLeft + halfWidth, irect.fBottom - quarterWidth,
edgeColor);
break; break;
......
...@@ -254,6 +254,96 @@ crbug.com/248938 [ Mac ] virtual/threaded/transitions/interrupted-all-transition ...@@ -254,6 +254,96 @@ crbug.com/248938 [ Mac ] virtual/threaded/transitions/interrupted-all-transition
crbug.com/542541 [ Debug ] fast/events/click-count.html [ Pass Failure ] crbug.com/542541 [ Debug ] fast/events/click-count.html [ Pass Failure ]
crbug.com/640256 [ Linux Win ] compositing/overflow/update-widget-positions-on-nested-frames-and-scrollers.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] css3/selectors3/html/css3-modsel-161.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] css3/selectors3/xhtml/css3-modsel-161.xml [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] css3/selectors3/xml/css3-modsel-161.xml [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] editing/pasteboard/4641033.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] editing/selection/replaced-boundaries-3.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] editing/selection/select-box.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] editing/selection/select-element-paragraph-boundary.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/block/float/float-avoidance.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/block/margin-collapse/103.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/color/color-suggestion-picker-appearance-zoom125.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/color/color-suggestion-picker-appearance-zoom200.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/color/color-suggestion-picker-appearance.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/color/color-suggestion-picker-one-row-appearance.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/color/color-suggestion-picker-two-row-appearance.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/control-clip-overflow.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/control-restrict-line-height.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/form-element-geometry.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select-popup/popup-menu-appearance-empty.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select-popup/popup-menu-appearance-long.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select-popup/popup-menu-appearance-many.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select-popup/popup-menu-appearance-rtl-default.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select-popup/popup-menu-appearance-single-option.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select-popup/popup-menu-appearance-styled.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select-popup/popup-menu-appearance-texttransform.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select-popup/popup-menu-appearance-transform.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select-popup/popup-menu-appearance-zoom.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select-popup/popup-menu-appearance-zoom090.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select-popup/popup-menu-appearance.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/003.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/004.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/HTMLOptionElement_label01.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/HTMLOptionElement_label02.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/HTMLOptionElement_label03.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/HTMLOptionElement_label04.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/HTMLOptionElement_label06.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/HTMLOptionElement_label07.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/disabled-select-change-index.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/menulist-appearance-rtl.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/menulist-deselect-update.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/menulist-no-overflow.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/menulist-restrict-line-height.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/menulist-separator-painting.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/menulist-style-color.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/menulist-width-change.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/optgroup-rendering.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/option-script.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/option-strip-whitespace.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/option-text-clip.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-align.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-background-none.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-baseline.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-change-listbox-to-popup.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-dirty-parent-pref-widths.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-disabled-appearance.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-initial-position.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-selected.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-size-invalid.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-style.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-visual-hebrew.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/select-writing-direction-natural.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/select/selectlist-minsize.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/forms/stuff-on-my-optgroup.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/html/keygen.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/invalid/014.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/parser/document-write-option.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/replaced/replaced-breaking-mixture.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/replaced/replaced-breaking.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] fast/replaced/three-selects-break.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] http/tests/webfont/popup-menu-load-webfont-after-open.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] tables/mozilla/bugs/bug1188.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] tables/mozilla/bugs/bug18359.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] tables/mozilla/bugs/bug2479-3.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] tables/mozilla/bugs/bug29326.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] tables/mozilla/bugs/bug33855.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] tables/mozilla/bugs/bug4382.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] tables/mozilla/bugs/bug96334.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] tables/mozilla/core/margins.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] tables/mozilla/dom/tableDom.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] transforms/2d/zoom-menulist.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] virtual/parsehtmlonmainthread_coalesce/fast/parser/document-write-option.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] virtual/parsehtmlonmainthread_sync/fast/parser/document-write-option.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] virtual/prefer_compositing_to_lcd_text/compositing/overflow/update-widget-positions-on-nested-frames-and-scrollers.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] virtual/scalefactor150/fast/hidpi/static/popup-menu-appearance.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] virtual/scalefactor200/fast/hidpi/static/popup-menu-appearance.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] virtual/scalefactor200withzoom/fast/hidpi/static/popup-menu-appearance.html [ NeedsRebaseline ]
crbug.com/640256 [ Linux Win ] webaudio/constructor/convolver.html [ NeedsRebaseline ]
crbug.com/640256 [ Win ] fast/forms/select-popup/popup-menu-appearance-tall.html [ NeedsRebaseline ]
# TODO(oshima): Mac Android are currently not supported. # TODO(oshima): Mac Android are currently not supported.
crbug.com/567837 [ Mac Android ] virtual/scalefactor200withzoom/fast/hidpi/static [ Skip ] crbug.com/567837 [ Mac Android ] virtual/scalefactor200withzoom/fast/hidpi/static [ Skip ]
......
...@@ -42,6 +42,7 @@ namespace blink { ...@@ -42,6 +42,7 @@ namespace blink {
namespace { namespace {
const unsigned defaultButtonBackgroundColor = 0xffdddddd; const unsigned defaultButtonBackgroundColor = 0xffdddddd;
const unsigned dropdownMenuListArrowPadding = 3;
bool useMockTheme() bool useMockTheme()
{ {
...@@ -262,11 +263,13 @@ void ThemePainterDefault::setupMenuListArrow(const LayoutBox& box, const IntRect ...@@ -262,11 +263,13 @@ void ThemePainterDefault::setupMenuListArrow(const LayoutBox& box, const IntRect
if (useMockTheme()) { if (useMockTheme()) {
// The size and position of the drop-down button is different between // The size and position of the drop-down button is different between
// the mock theme and the regular aura theme. // the mock theme and the regular aura theme.
int spacingTop = (box.borderTop() + box.paddingTop()).toInt(); int extraPadding = dropdownMenuListArrowPadding * box.styleRef().effectiveZoom();
int spacingBottom = (box.borderBottom() + box.paddingBottom()).toInt(); // The width available for the arrow is based on the padding provided
int spacingRight = (box.borderRight() + box.paddingRight()).toInt(); // in the child LayoutBox.
extraParams.menuList.arrowX = (box.styleRef().direction() == RTL) ? rect.x() + 4 + spacingRight: right - 10 - spacingRight; int arrowBoxWidth = ((box.styleRef().direction() == RTL) ? box.firstChildBox()->paddingLeft() : box.firstChildBox()->paddingRight()).toInt();
extraParams.menuList.arrowSize = rect.height() - spacingBottom - spacingTop; int arrowSize = std::min(arrowBoxWidth, rect.height()) - 2 * extraPadding;
extraParams.menuList.arrowX = (box.styleRef().direction() == RTL) ? rect.x() + extraPadding + (arrowSize / 2) : right - (arrowSize / 2) - extraPadding;
extraParams.menuList.arrowSize = arrowSize;
} else { } else {
const int arrowSize = 6; const int arrowSize = 6;
const int arrowPadding = 6; const int arrowPadding = 6;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment