Missing layout and css is not applied when things like MediaDocument loads |
||||
Issue descriptionFound 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).
,
Mar 12 2016
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.
,
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.
,
Mar 12 2016
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?
,
Mar 13 2016
Yes, moving the rules to html.css works. Thanks for the info
,
Oct 19 2016
Sounds like this was an implementation detail resolved in #4/5 |
||||
►
Sign in to add a comment |
||||
Comment 1 by esprehn@chromium.org
, Mar 11 2016Components: Blink>CSS