Ignore:
Timestamp:
Sep 26, 2013, 9:57:42 AM (12 years ago)
Author:
[email protected]
Message:

Inset box-shadows fail to round around corners when border-radius is set in vh/vw units.
https://bugs.webkit.org/show_bug.cgi?id=119187

Patch by Gurpreet Kaur <[email protected]> on 2013-09-26
Reviewed by Darin Adler.

Source/WebCore:

Border-radius properties were not applied incase its values
were given in vh, vw, vmax, vmin units.

Tests: fast/css/border-radius-inset-box-shadow-viewportlength.html

fast/css/border-radius-viewport-height.html
fast/css/border-radius-viewport-vmax.html
fast/css/border-radius-viewport-vmin.html

  • css/DeprecatedStyleBuilder.cpp:

(WebCore::ApplyPropertyBorderRadius::applyValue):
(WebCore::ApplyPropertyComputeLength::applyValue):

  • css/StyleResolver.h:

Calculating the border-radius values which has been specified
in viewport units.The vh/vw units are calcultated as percent of
viewport height and viewport width respectively. 1vmax: 1vw or 1vh,
whatever is largest.1vmin: 1vw or 1vh, whatever is smallest.

LayoutTests:

  • fast/css/border-radius-inset-box-shadow-viewportlength-expected-mismatch.html: Added.
  • fast/css/border-radius-inset-box-shadow-viewportlength.html: Added.
  • fast/css/border-radius-viewport-height-expected-mismatch.html: Added.
  • fast/css/border-radius-viewport-height.html: Added.
  • fast/css/border-radius-viewport-vmax-expected-mismatch.html: Added.
  • fast/css/border-radius-viewport-vmax.html: Added.
  • fast/css/border-radius-viewport-vmin-expected-mismatch.html: Added.
  • fast/css/border-radius-viewport-vmin.html: Added.

Added new tests for verifying that box-shadow and border-radius properties
are applied when its values are viewport units.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/css/DeprecatedStyleBuilder.cpp

    r156260 r156466  
    450450            radiusWidth = Length(pair->first()->getDoubleValue(), Percent);
    451451        else if (pair->first()->isViewportPercentageLength())
    452             radiusWidth = pair->first()->viewportPercentageLength();
     452            radiusWidth = Length(styleResolver->viewportPercentageValue(*pair->first(), pair->first()->getIntValue()), Fixed);
    453453        else if (pair->first()->isCalculatedPercentageWithLength())
    454454            radiusWidth = Length((pair->first()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
     
    458458            radiusHeight = Length(pair->second()->getDoubleValue(), Percent);
    459459        else if (pair->second()->isViewportPercentageLength())
    460             radiusHeight = pair->second()->viewportPercentageLength();
     460            radiusHeight = Length(styleResolver->viewportPercentageValue(*pair->second(), pair->second()->getIntValue()), Fixed);
    461461        else if (pair->second()->isCalculatedPercentageWithLength())
    462462            radiusHeight = Length((pair->second()->cssCalcValue()->toCalcValue(styleResolver->style(), styleResolver->rootElementStyle(), styleResolver->style()->effectiveZoom())));
     
    626626                    length = 1.0;
    627627            }
    628             if (primitiveValue->isViewportPercentageLength()) {
    629                 int viewPortHeight = styleResolver->document().renderView()->viewportSize().height() * length / 100.0f;
    630                 int viewPortWidth = styleResolver->document().renderView()->viewportSize().width() * length / 100.0f;
    631                 if (primitiveValue->isViewportPercentageHeight())
    632                     length = viewPortHeight;
    633                 else if (primitiveValue->isViewportPercentageWidth())
    634                     length = viewPortWidth;
    635                 else if (primitiveValue->isViewportPercentageMax())
    636                     length = max(viewPortWidth, viewPortHeight);
    637                 else if (primitiveValue->isViewportPercentageMin())
    638                     length = min(viewPortWidth, viewPortHeight);
    639             }
     628            if (primitiveValue->isViewportPercentageLength())
     629                length = styleResolver->viewportPercentageValue(*primitiveValue, length);
    640630        } else {
    641631            ASSERT_NOT_REACHED();
Note: See TracChangeset for help on using the changeset viewer.