Bug 25197

Summary: implement orientation and aspect-ratio media queries
Product: WebKit Reporter: Dean Jackson <dino>
Component: CSSAssignee: Simon Fraser (smfr) <simon.fraser>
Status: RESOLVED FIXED    
Severity: Normal CC: simon.fraser
Priority: P2 Keywords: InRadar
Version: 528+ (Nightly build)   
Hardware: Mac   
OS: OS X 10.5   
Attachments:
Description Flags
patch
none
patch now does live updating simon.fraser: review+

Dean Jackson
Reported 2009-04-14 17:58:30 PDT
http://www.w3.org/TR/css3-mediaqueries/#orientation We don't yet implement orientation and aspect-ratio <rdar://problem/6791666>
Attachments
patch (9.63 KB, patch)
2009-04-15 12:40 PDT, Dean Jackson
no flags
patch now does live updating (10.99 KB, patch)
2009-04-15 19:44 PDT, Dean Jackson
simon.fraser: review+
Dean Jackson
Comment 1 2009-04-15 12:40:18 PDT
Created attachment 29512 [details] patch obviously patch needs PNG pixel results too.
Dean Jackson
Comment 2 2009-04-15 12:45:50 PDT
Hmmm.. Firefox reevaluates media queries as the page resizes.
Dean Jackson
Comment 3 2009-04-15 19:44:02 PDT
Created attachment 29524 [details] patch now does live updating patch now links up viewport changes to re-evaluation
Simon Fraser (smfr)
Comment 4 2009-05-12 11:16:12 PDT
Comment on attachment 29524 [details] patch now does live updating > +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
Dean Jackson
Comment 5 2009-05-14 16:15:13 PDT
Committed r43739 M WebCore/ChangeLog M WebCore/css/MediaQueryExp.h M WebCore/css/MediaFeatureNames.h M WebCore/css/MediaQueryEvaluator.cpp A LayoutTests/platform/mac/fast/media/mq-aspect-ratio-expected.checksum A LayoutTests/platform/mac/fast/media/mq-orientation-expected.png A LayoutTests/platform/mac/fast/media/mq-orientation-expected.txt A LayoutTests/platform/mac/fast/media/mq-aspect-ratio-expected.png A LayoutTests/platform/mac/fast/media/mq-orientation-expected.checksum A LayoutTests/platform/mac/fast/media/mq-aspect-ratio-expected.txt M LayoutTests/ChangeLog A LayoutTests/fast/media/mq-orientation.html A LayoutTests/fast/media/mq-aspect-ratio.html with early return fix, and no else
Note You need to log in before you can comment on or make changes to this bug.