New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 592080 link

Starred by 2 users

Issue metadata

Status: WontFix
Owner: ----
Closed: Oct 2016
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Android
Pri: 2
Type: ----



Sign in to add a comment

Missing layout and css is not applied when things like MediaDocument loads

Project Member Reported by qin...@chromium.org, Mar 4 2016

Issue description

Found an issue that if I make some changes to the MediaDocument.cpp ( for example, adding an element and apply some css), the css has to be put in the MediaDocument.cpp when creating the element by calling setAttribute(styleAttr,...). 

If the css is put in the  .css files, (html.css, e.g), some of the css will not be applied when document loads. However, when I refresh the page, the css will be applied.

So somehow we are missing a layout in MediaDocument(potentially other documents like ImageDocument too).
 
Cc: meade@chromium.org r...@opera.com
Components: Blink>CSS
rune@ I think this is a bug with what sheets to consider?

Comment 2 by r...@opera.com, Mar 12 2016

Labels: Needs-Feedback
You need to be more specific about which rules are added to which stylesheet and where you add elements to the MediaDocument structure that you expect to match the added rules.

Comment 3 by qin...@chromium.org, Mar 12 2016

you can apply this cl locally: https://codereview.chromium.org/1780043002/, and move all the css from MediaDocument.cpp to mediaControlsNew.css:

body:-webkit-full-page-media > div > a {
   display: block;
   width: 120px;
   height: 36px;
   background: #4285F4;
   font-family: Roboto;
   font-size: 14px;
   border-radius: 5px;
   color: white;
   font-weight: bold;
   text-decoration: none;
   text-transform: uppercase;
   text-align: center;
   line-height: 36px;
   margin: 32px auto 0 auto;
}


body:-webkit-full-page-media > div {
    max-height: 100%;
    max-width: 100%;
    position: absolute;
    top: 50%;
    left: 50%;
    margin-right: -50%;
    transform: translate(-50%, -50%); 
}

Now build the code with os=android (not sure whether the bug reproduces on desktop though) and install it on a android phone, you can easily see that the button is misplaced when document loads, but works fine when you refreshes the page.

Comment 4 by r...@opera.com, Mar 12 2016

Status: Available (was: Unconfirmed)
Ah. It's because the specific UA style sheets for svg, media controls, etc are lazily loaded as we see elements which need them. So, for media controls in particular, we don't create the default style until we see a video or audio element. That means the elements we calculate style for before we encounter a media element (like body in this case) will not get the right style the first time.

The assumption for mediaControls.css is that it is for styling media controls only. They are always in video/audio's UA shadow?

Having these rules in html.css instead should work though?

Comment 5 by qin...@chromium.org, Mar 13 2016

Yes, moving the rules to html.css works. Thanks for the info
Labels: -Needs-Feedback
Status: WontFix (was: Available)
Sounds like this was an implementation detail resolved in #4/5

Sign in to add a comment