WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
Bug 131319
Allow elements to register for changes in page scale
https://bugs.webkit.org/show_bug.cgi?id=131319
Summary
Allow elements to register for changes in page scale
Dean Jackson
Reported
2014-04-07 15:53:02 PDT
Some HTML elements might want to react to changes in the page scale.
Attachments
Patch
(4.13 KB, patch)
2014-04-07 15:57 PDT
,
Dean Jackson
no flags
Details
Formatted Diff
Diff
Patch
(7.76 KB, patch)
2014-04-07 17:01 PDT
,
Dean Jackson
no flags
Details
Formatted Diff
Diff
Patch
(8.57 KB, patch)
2014-04-07 19:15 PDT
,
Dean Jackson
no flags
Details
Formatted Diff
Diff
Show Obsolete
(2)
View All
Add attachment
proposed patch, testcase, etc.
Radar WebKit Bug Importer
Comment 1
2014-04-07 15:54:22 PDT
<
rdar://problem/16545804
>
Dean Jackson
Comment 2
2014-04-07 15:57:12 PDT
Created
attachment 228765
[details]
Patch
Dean Jackson
Comment 3
2014-04-07 17:01:08 PDT
Created
attachment 228773
[details]
Patch
Eric Carlson
Comment 4
2014-04-07 17:12:46 PDT
Comment on
attachment 228773
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=228773&action=review
> Source/WebCore/ChangeLog:25 > + * html/HTMLMediaElement.cpp: > + (WebCore::HTMLMediaElement::HTMLMediaElement): > + (WebCore::HTMLMediaElement::~HTMLMediaElement): Remove ourselves from the > + callback if necessary.
Nit: you forgot "setMediaControlsDependOnPageScaleFactor".
> Source/WebCore/ChangeLog:28 > + (WebCore::HTMLMediaElement::mediaControlsDependOnPageScaleFactor): Add ourselves to
Nit: This is the accessor.
> Source/WebCore/ChangeLog:31 > + (WebCore::Page::setPageScaleFactor): Tell the document that the user has zoomed.
Nit: "the document" -> "all documents"
> Source/WebCore/dom/Document.cpp:4199 > +void Document::registerForPageScaleFactorChangedCallbacks(HTMLMediaElement* e)
Nit: might as well spell out "element".
> Source/WebCore/dom/Document.cpp:4204 > +void Document::unregisterForPageScaleFactorChangedCallbacks(HTMLMediaElement* e)
Ditto.
> Source/WebCore/html/HTMLMediaElement.cpp:422 > + if (m_mediaControlsDependOnPageScaleFactor) > + document().unregisterForPageScaleFactorChangedCallbacks(this);
Can this go in HTMLMediaElement::unregisterWithDocument?
> Source/WebCore/html/HTMLMediaElement.cpp:5986 > +void HTMLMediaElement::setMediaControlsDependOnPageScaleFactor(bool v)
Nit: you might as well use a descriptive variable name.
> Source/WebCore/html/HTMLMediaElement.h:892 > + bool m_mediaControlsDependOnPageScaleFactor : 1;
Nit: this should be grouped with the other 1-bit bools to make the element slightly smaller.
Simon Fraser (smfr)
Comment 5
2014-04-07 17:15:59 PDT
Comment on
attachment 228773
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=228773&action=review
r- for the "moving between documents" issue.
> Source/WebCore/dom/Document.cpp:4199 > +void Document::registerForPageScaleFactorChangedCallbacks(HTMLMediaElement* e)
e -> element.
> Source/WebCore/html/HTMLMediaElement.cpp:423 > +#if ENABLE(MEDIA_CONTROLS_SCRIPT) > + if (m_mediaControlsDependOnPageScaleFactor) > + document().unregisterForPageScaleFactorChangedCallbacks(this); > +#endif
What happens when an element moves between documents?
> Source/WebCore/html/HTMLMediaElement.cpp:5986 > +void HTMLMediaElement::setMediaControlsDependOnPageScaleFactor(bool v)
v -> something.
> Source/WebCore/page/Page.cpp:737 > +#if ENABLE(MEDIA_CONTROLS_SCRIPT) > + for (Frame* frame = &mainFrame(); frame; frame = frame->tree().traverseNext()) > + frame->document()->pageScaleFactorChanged(); > +#endif
Don't we already do this somewhere, e.g. to tell compositing that the scale changed? Can this happen to pages in the page cache?
Dean Jackson
Comment 6
2014-04-07 17:26:27 PDT
Comment on
attachment 228773
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=228773&action=review
>> Source/WebCore/html/HTMLMediaElement.cpp:422 >> + document().unregisterForPageScaleFactorChangedCallbacks(this); > > Can this go in HTMLMediaElement::unregisterWithDocument?
Yes, and that will solve Simon's issue.
>> Source/WebCore/html/HTMLMediaElement.cpp:423 >> +#endif > > What happens when an element moves between documents?
I'll fix that.
>> Source/WebCore/html/HTMLMediaElement.h:892 >> + bool m_mediaControlsDependOnPageScaleFactor : 1; > > Nit: this should be grouped with the other 1-bit bools to make the element slightly smaller.
OK.
>> Source/WebCore/page/Page.cpp:737 >> +#endif > > Don't we already do this somewhere, e.g. to tell compositing that the scale changed? > > Can this happen to pages in the page cache?
We do similar stuff in this method. e.g. if (view && view->fixedElementsLayoutRelativeToFrame()) view->setViewportConstrainedObjectsNeedLayout(); This is basically the same thing but there is no point going up to the view for it.
Dean Jackson
Comment 7
2014-04-07 19:15:03 PDT
Created
attachment 228794
[details]
Patch
Eric Carlson
Comment 8
2014-04-07 20:16:27 PDT
Comment on
attachment 228794
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=228794&action=review
> Source/WebCore/ChangeLog:29 > + (WebCore::HTMLMediaElement::setMediaControlsDependOnPageScaleFactor): Add ourselves to > + the callback if necessary.
Nit: Add -> Add/remove
Dean Jackson
Comment 9
2014-04-08 11:07:08 PDT
Committed
r166937
: <
http://trac.webkit.org/changeset/166937
>
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug