[Webkit-unassigned] [Bug 25197] implement orientation and aspect-ratio media queries

bugzilla-daemon at webkit.org bugzilla-daemon at webkit.org
Tue May 12 11:16:13 PDT 2009


https://bugs.webkit.org/show_bug.cgi?id=25197


simon.fraser at apple.com changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
  Attachment #29524|review?(hyatt at apple.com)    |review+
               Flag|                            |




------- Comment #4 from simon.fraser at apple.com  2009-05-12 11:16 PDT -------
(From update of attachment 29524)
> +static bool orientationMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix)
> +{
> +    if (value) {

An early return if !(value) would make the code simpler.

> +        FrameView* view = frame->view();
> +        int width = view->layoutWidth();
> +        int height = view->layoutHeight();
> +        if (width > height) // Square viewport is portrait
> +            return "landscape" == static_cast<CSSPrimitiveValue*>(value)->getStringValue();
> +        else
> +            return "portrait" == static_cast<CSSPrimitiveValue*>(value)->getStringValue();

Don't use 'else' after 'return'.

> +static bool aspect_ratioMediaFeatureEval(CSSValue* value, RenderStyle*, Frame* frame, MediaFeaturePrefix op)
> +{
> +    if (value) {

Prefer early return.

r=me


-- 
Configure bugmail: https://bugs.webkit.org/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.



More information about the webkit-unassigned mailing list