Read-only Git mirror of the Mercurial gecko repositories at https://hg.mozilla.org. How to contribute: https://firefox-source-docs.mozilla.org/contributing/contribution_quickref.html
Go to file
Razvan Caliman 780c3bc0b5 Bug 1572651 - (Part 2) Split BoxModelHighlighter into observer and renderer parts. r=pbro,jdescottes
NOTE: To use the new box model highlighter, flip this pref to true: `devtools.inspector.use-new-box-model-highlighter`

Adding Julian as reviewer to check the sanity of the communication system (see `BoxModelHiglighterObserver` constructor and `BoxModelHighlighterRenderer.setMessageManager()`, `BoxModelHighlighterRenderer.onMessage()`,  `BoxModelHighlighterRenderer.postMessage()`) and Patrick for the overall highlighter behavior which is mostly a clean split of the existing [`BoxModelHighlighter`](https://searchfox.org/mozilla-central/rev/f43ae7e1c43a4a940b658381157a6ea6c5a185c1/devtools/server/actors/highlighters/box-model.js)).

---

Depends on D47091

## Preamble

This patch looks more frightening than it actually is. Let me explain:

The vast majority of the code in `box-model-highlighter-observer.js` and `box-model-highlighter-renderer.js` is a clean split of the code existing in `box-model-highlighter.js` into distinct parts which handle the node measurement (observer) and the drawing the highlighter (renderer). I kept the method names identical to help in matching them up with their original sources.

There was no simple way chunk this without confusing the daylight out of you so I decided to co-locate all changes so it's easier to track and reference methods.

I will detail below the important differences.


## Overview:

The box model highlighter is split into two distinct parts:
- an observer which monitors the node's position
- a renderer which draws the highlighter on top of the node

The renderer always lives in the parent process (browser window) and overlays an iframe with the highlighter markup:
- either over the content if highlighting in the context of the content toolbox
- or over the whole browser UI if highlighting in the context of the browser toolbox

When in the context of the browser toolbox (i.e. highlighting the browser UI), both observer and renderer live in the parent process. Communication is done by direct calls.

When in the context of the content toolbox (i.e. highlighting the page content), the observer lives in content process (so it can measure the node) while the renderer lives in the parent process. Communication is done by message passing via `MessageManager` (soon to be deprecated and replaced with JSWindowActor API)

## Notable differences after the split

- the observer checks whether it is in the content process (aka child process) and sets up the highlighter in the parent process by using [`setupInParent()`](https://docs.firefox-dev.tools/backend/actor-e10s-handling.html) and establishes a communication system to it via message manager. If the observer is in the parent process (browser toolbox scenario), the renderer is setup directly via its constructor and no additional communication system is required.

- whenever the node quads change (as determined by the untouched existing base class `auto-refresh.js`), the observer gathers the data about the node position and sends it over to the renderer. This happens in the `BoxModelHighlighterObserver._update()` (corresponding to the [`_update()` from the existing highlighter](https://searchfox.org/mozilla-central/rev/45f30e1d19bde27bf07e47a0a5dd0962dd27ba18/devtools/server/actors/highlighters/box-model.js#361-383)).

- the renderer expects its `render()` method to be called with the necessary node position information whenever it should update the highlighter. It is the entry point which then calls all the DOM manipulation methods copied over from the existing box model highlighter.

- the only notable change in DOM manipulation methods is in `BoxModelHighlighterRenderer._updateBoxModel()` (corresponding to [`updateBoxModel()` from the existing highlighter](https://searchfox.org/mozilla-central/rev/45f30e1d19bde27bf07e47a0a5dd0962dd27ba18/devtools/server/actors/highlighters/box-model.js#504-560)) where the `_nodeNeedsHighlighting()` is kept on the observer part and the canvas zoom adjustment is removed  (`this.markup.scaleRootElement(this.currentNode, rootId)`) because the canvas is no longer influenced by the page zoom (the canvas lives in the browser window, not the content window)

Differential Revision: https://phabricator.services.mozilla.com/D47092

--HG--
rename : devtools/server/actors/highlighters/box-model.js => devtools/server/actors/highlighters/box-model-renderer.js
extra : moz-landing-system : lando
2019-10-10 14:15:22 +00:00
.cargo Bug 1582650 - Cranelift: update version to 0.44, rev to 182414f15c18538dfebbe040469ec8001e93ecc5. r=bbouvier. 2019-09-26 09:40:11 +00:00
.vscode Bug 1583388 - Recommend the Firefox debugger VSCode plugin. r=jlast 2019-09-26 22:01:19 +00:00
accessible Bug 1587791 - remove XBL backed accessible relations support r=MarcoZ 2019-10-10 14:08:17 +00:00
browser Bug 1572651 - (Part 2) Split BoxModelHighlighter into observer and renderer parts. r=pbro,jdescottes 2019-10-10 14:15:22 +00:00
build Bug 1586358 - Replace existing instances of GENERATED_FILES with references to the GeneratedFile template r=firefox-build-system-reviewers,mshal 2019-10-07 21:15:19 +00:00
caps Bug 1583949 - Add a check for IsEvalAllowed to the worker callpath for eval() r=ckerschb,baku 2019-10-08 17:31:35 +00:00
chrome Bug 1585156 - Remove useless inclusions of nsIDOMWindow.h and nsIDOMWindowUtils.h r=smaug 2019-09-30 22:06:47 +00:00
config Bug 1586358 - Replace existing instances of GENERATED_FILES with references to the GeneratedFile template r=firefox-build-system-reviewers,mshal 2019-10-07 21:15:19 +00:00
devtools Bug 1572651 - (Part 2) Split BoxModelHighlighter into observer and renderer parts. r=pbro,jdescottes 2019-10-10 14:15:22 +00:00
docshell Bug 1583271 - Part 1: Change profiler page information IDs to BrowsingContextID and InnerWindowID r=gerald,nika 2019-10-09 21:25:11 +00:00
dom Backed out changeset 3a52a67311e2 (bug 1580602) to reland with part2 and part3 2019-10-10 10:22:51 +03:00
editor Bug 1566795 - part 6: Make HTMLEditor::RemoveInlinePropertyInternal() remove text node style which comes from block parent r=m_kato 2019-10-09 08:04:34 +00:00
extensions Bug 1586878 - Replace <xul:textbox> with <html:input> in test_add_remove_dictionaries.xul;r=mossop 2019-10-08 17:13:43 +00:00
gfx Bug 1587695 - Fix redundant SwapChain re-creation r=nical 2019-10-10 08:58:00 +00:00
gradle/wrapper Bug 1522795 - Update android gradle plugin to 3.4.2. r=nalexander 2019-07-24 18:48:54 +00:00
hal Bug 1585156 - Remove useless inclusions of nsIDOMWindow.h and nsIDOMWindowUtils.h r=smaug 2019-09-30 22:06:47 +00:00
image Bug 1551088 - Part 8. Add reftest annotations for slight premultiplication differences. r=tnikkel 2019-10-02 13:37:32 +00:00
intl Bug 1586216: Fallback to a synchronous channel load if the url preloader cannot load the ftl file. r=kmag 2019-10-09 17:50:33 +00:00
ipc Backed out 11 changesets (bug 1578624) for build bustages. CLOSED TREE 2019-10-09 11:50:37 +03:00
js Bug 1586252 - Adapt to spec change for src/dest idx for table.copy/memory.copy. r=rhunt 2019-10-09 13:44:55 +00:00
layout Bug 1587661 - Really minor cleanup to the scroll anchoring suppression code. r=dholbert 2019-10-10 07:06:08 +00:00
media Bug 1587159 - Fix undefined shift in g722_encode.c; r=ng 2019-10-09 20:12:28 +00:00
memory Bug 1587066 - Use native abort() for ThreadSanitizer. r=jseward 2019-10-09 14:27:21 +00:00
mfbt Bug 1584256 - Add IPDLParamTraits for Variant. r=nika,jwalden 2019-10-08 16:03:11 +00:00
mobile Bug 1563343 - Do not search for OS protocol handlers in GV; just let Gecko return ERROR_UNKNOWN_PROTOCOL. r=snorp,geckoview-reviewers,esawin 2019-10-08 19:05:09 +00:00
modules Bug 1587448 enable XTCO-nosniff by default r=ckerschb 2019-10-09 17:24:33 +00:00
mozglue Bug 1587332 - Encapsulate ActivePS::mProfileBuffer as a ProfileBuffer value - r=canaltinova 2019-10-10 10:52:09 +00:00
netwerk Bug 1586845, r=dragana 2019-10-09 15:58:18 +00:00
nsprpub Bug 1586867 - Upgrade Firefox 71 to use NSPR 4.23. r=jcj NSPR_4_23_BETA1 UPGRADE_NSPR_RELEASE 2019-10-07 22:07:04 +00:00
other-licenses Bug 1578489 - New Windows installer icon. r=agashlin 2019-09-23 22:00:43 +00:00
parser Bug 1510785 - Only build XBL related code when MOZ_XBL is defined. r=bzbarsky 2019-10-08 23:52:14 +00:00
python Bug 1510785 - Support disabling XBL related tests. r=gbrown 2019-10-08 23:52:33 +00:00
remote Bug 1547961 - [remote] Unskip browser_runtime_executionContext.js on Mac and Windows. r=remote-protocol-reviewers,ato 2019-10-04 09:35:48 +00:00
security Bug 1583067 - Use correct window opener for chrome windows in certManager.js. r=kmag 2019-10-08 21:37:57 +00:00
services Bug 1577690 - WebChannel support for optional Sync. r=vladikoff 2019-10-08 15:19:23 +00:00
servo Bug 1587368 - Revert ccov bustage workaround now that builds have been updated. 2019-10-10 09:44:19 +00:00
startupcache Bug 1550108 - Reduce stack size on StartupCache threads r=froydnj 2019-10-04 20:45:41 +00:00
storage Bug 1560667 - Collection of fixes for things uncovered by improvements to the hazard analysis. r=bzbarsky 2019-10-02 03:20:33 +00:00
taskcluster Bug 1572411 - Investigate JetStream2 perma-fail on Windows 10 AArch64 opt platform r=perftest-reviewers,sparky 2019-10-10 13:17:50 +00:00
testing Bug 1484927 - [marionette] Temporary skip TestBackForwardNavigation.test_data_urls. r=webdriver-reviewers,ato 2019-10-10 10:32:40 +00:00
third_party Bug 1587468 - Update headers_derive to v0.1.1. r=ato 2019-10-10 10:31:14 +00:00
toolkit Bug 1579522 - Don't trigger a "modules" ping in the first session r=janerik,aklotz 2019-10-10 13:45:30 +00:00
tools Bug 1587332 - Encapsulate ActivePS::mProfileBuffer as a ProfileBuffer value - r=canaltinova 2019-10-10 10:52:09 +00:00
uriloader Bug 1563343 - Do not search for OS protocol handlers in GV; just let Gecko return ERROR_UNKNOWN_PROTOCOL. r=snorp,geckoview-reviewers,esawin 2019-10-08 19:05:09 +00:00
view Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan 2019-10-06 18:29:55 +00:00
widget Bug 1553835 - Set GTK window hint to make PIP window floating r=stransky 2019-10-10 10:00:32 +00:00
xpcom Bug 1587378 - Remove TraceCallbacks method that takes raw JSObject pointers r=mccr8 2019-10-09 14:34:16 +00:00
xpfe/appshell Bug 1585156 - Remove useless inclusions of nsIDOMWindow.h and nsIDOMWindowUtils.h r=smaug 2019-09-30 22:06:47 +00:00
.arcconfig
.clang-format
.clang-format-ignore Bug 1580356 - Remove Fennec (Firefox for Android). r=snorp,mshal 2019-10-04 20:55:11 +00:00
.cron.yml Bug 1578495 - Run searchfox jobs on ash. r=asuth 2019-10-06 20:00:09 +00:00
.eslintignore Bug 1583785 - Remove devtools webpack reference in eslintignore r=Standard8 2019-09-25 12:15:29 +00:00
.eslintrc.js Bug 1579452 - Enable ESLint rule no-async-promise-executor on disabled locations for devtools. r=jlast 2019-09-17 17:50:23 +00:00
.flake8 Bug 1567642 - [lint.flake8] Skip remaining flake8 under Python 3 lint issues r=gbrown 2019-09-24 14:46:38 +00:00
.gdbinit
.gdbinit_python Bug 1564314 - Move gdbpp back to python/. r=nalexander 2019-07-11 02:39:31 +00:00
.git-blame-ignore-revs Bug 1572125 - Update .hg-annotate-ignore-revs and .git-blame-ignore-revs to ignore devtools/client/responsive reformatting using Prettier (Bug 1569574) in blame/annotate. r=vporof 2019-08-12 17:27:22 +00:00
.gitattributes
.gitignore Bug 1559479 - mach lint complains about newtab node_modules r=dmose 2019-07-12 15:24:07 +00:00
.hg-annotate-ignore-revs Bug 1572125 - Update .hg-annotate-ignore-revs and .git-blame-ignore-revs to ignore devtools/client/responsive reformatting using Prettier (Bug 1569574) in blame/annotate. r=vporof 2019-08-12 17:27:22 +00:00
.hg-format-source
.hgignore Bug 1575089 - Add a new Talos test that measures warm startup time with a number of real-world WebExtensions installed. r=rwood 2019-08-31 06:58:00 +00:00
.hgtags No bug - Tagging mozilla-central b338d55d5007ce5a7d4cdce3aaa8e9f63c5555f7 with FIREFOX_NIGHTLY_70_END a=release DONTBUILD CLOSED TREE 2019-09-02 08:59:36 +00:00
.lldbinit
.mailmap
.prettierignore Bug 1572332 - Move non-debugger devtools prefs into all.js and firefox.js. r=jdescottes 2019-08-26 01:44:59 +00:00
.prettierrc Bug 1578564 - Workaround a prettier warning so that we can run it on html/xhtml files. r=vporof 2019-09-04 06:59:03 +00:00
.taskcluster.yml Bug 1580622: Disable python bytecode generation in the decision task; r=nalexander on a CLOSED TREE 2019-10-07 22:48:48 +00:00
.trackerignore
.yamllint
.ycm_extra_conf.py
aclocal.m4
AUTHORS
build.gradle Bug 1580356 - Remove Fennec (Firefox for Android). r=snorp,mshal 2019-10-04 20:55:11 +00:00
Cargo.lock Bug 1587468 - Update headers_derive to v0.1.1. r=ato 2019-10-10 10:31:14 +00:00
Cargo.toml Bug 1582650 - Cranelift: update version to 0.44, rev to 182414f15c18538dfebbe040469ec8001e93ecc5. r=bbouvier. 2019-09-26 09:40:11 +00:00
client.mk
client.py Bug 1559975 - fix python2 and python3 linter errors for client.py r=ahal 2019-09-11 21:06:34 +00:00
CLOBBER Update configs. IGNORE BROKEN CHANGESETS CLOSED TREE NO BUG a=release ba=release 2019-09-02 09:00:31 +00:00
configure.in
configure.py Bug 844509 - Always encode config.status as utf-8. r=nalexander 2019-08-21 21:26:32 +00:00
GNUmakefile
gradle.properties Bug 1577814 - Increase Gradle heap size. r=nalexander 2019-08-30 17:13:46 +00:00
gradlew
gradlew.bat
LEGAL
LICENSE
mach Bug 1578348, drop compare-locales from the mach python2 list, r=Callek,ahal 2019-10-08 13:58:33 +00:00
Makefile.in Bug 1540276: Migrate authenticode signing to autograph r=Callek,mshal 2019-09-30 13:57:32 +00:00
moz.build Bug 1580028 - Always merge PGO profile data in the run task; r=firefox-build-system-reviewers,chmanchester 2019-09-10 21:56:15 +00:00
moz.configure Bug 1580670 - Disable Visual Studio backend when building GeckoView on Windows. r=froydnj 2019-09-17 13:47:50 +00:00
mozilla-config.h.in
old-configure.in Bug 1585355 - Back out (part of) Bug 1443823, removing -fno-keep-inline-dllexport which was only applied to mingw-gcc r=dmajor 2019-10-03 16:01:26 +00:00
package-lock.json Bug 1540982 - Upgrade to ESLint 6.2.2 and switch to ECMA version 11 (BigInt support, Dynamic imports). r=mossop 2019-08-27 14:51:29 +00:00
package.json Bug 1540982 - Upgrade to ESLint 6.2.2 and switch to ECMA version 11 (BigInt support, Dynamic imports). r=mossop 2019-08-27 14:51:29 +00:00
README.txt
settings.gradle Bug 1580356 - Remove Fennec (Firefox for Android). r=snorp,mshal 2019-10-04 20:55:11 +00:00
substitute-local-geckoview.gradle Bug 1533465 - Add Gradle script for substituting local GeckoView into downstream consumers. r=sebastian 2019-08-15 21:18:24 +00:00
test.mozbuild

An explanation of the Mozilla Source Code Directory Structure and links to
project pages with documentation can be found at:

    https://developer.mozilla.org/en/Mozilla_Source_Code_Directory_Structure

For information on how to build Mozilla from the source code, see:

    https://developer.mozilla.org/en/docs/Build_Documentation

To have your bug fix / feature added to Mozilla, you should create a patch and
submit it to Bugzilla (https://bugzilla.mozilla.org). Instructions are at:

    https://developer.mozilla.org/en/docs/Creating_a_patch
    https://developer.mozilla.org/en/docs/Getting_your_patch_in_the_tree

If you have a question about developing Mozilla, and can't find the solution
on https://developer.mozilla.org, you can try asking your question in a
mozilla.* Usenet group, or on IRC at irc.mozilla.org. [The Mozilla news groups
are accessible on Google Groups, or news.mozilla.org with a NNTP reader.]

Nightly development builds can be downloaded from:

    https://archive.mozilla.org/pub/firefox/nightly/latest-mozilla-central/
            - or -
    https://www.mozilla.org/firefox/channel/desktop/#nightly

Keep in mind that nightly builds, which are used by Mozilla developers for
testing, may be buggy.