gecko-dev | Firefox Gecko integration with Web Speech API
kandi X-RAY | gecko-dev Summary
kandi X-RAY | gecko-dev Summary
An explanation of the Mozilla Source Code Directory Structure and links to project pages with documentation can be found at:.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
Currently covering the most popular Java, JavaScript and Python libraries. See a Sample of gecko-dev
gecko-dev Key Features
gecko-dev Examples and Code Snippets
Community Discussions
Trending Discussions on gecko-dev
QUESTION
I am trying to clean text in the exact way that Firefox does before spell checking individual words for a Firefox extension I'm building (my addon uses nspell, a JavaScript implementation of Hunspell, since Firefox doesn't expose the Hunspell instance it uses via the extension API).
I've looked at the Firefox gecko cloned codebase, i.e. in the mozSpellChecker.h file and other related files by searching for "spellcheck" but I cannot seem to find out how they are cleaning text.
Reverse engineering it has been a major PITA, I have this so far:
...ANSWER
Answered 2020-Jun-19 at 17:30I believe you want the functions in mozInlineSpellWordUtil.cpp
.
From the header:
QUESTION
I'm trying to get the exact formula in order to compute CSS border-radius property in a canvas. I've already tried and have an example in javascript (see below), but with no success.
Its seems that the browser is still adding some adaptations in order to ajust the borders. And i'm unable to identify them. So i've checked the sources of the Gecko layout engine, but i'm not sure where i can find this formula (in the sources).
It may be in layout/painting/nsCSSRenderingBorders.cpp
, but there's still a lot of code and it's C++ (i've no skills into that language)
See Gecko repository : https://github.com/mozilla/gecko-dev
So, if anyone could help me in order to achieve this adaptation, or give me the blocks of code which are computing border-radius "arcs, orientation ?" (in gecko) i'll be able to do that.
Javascript/HTML snippet (current, close from good adaptation)
(RED SHAPE = Canvas shape, GREEN SHAPE = HTML shape)
I'm using this function to draw the shape : ctx.constructor.prototype.fillRoundedRect
And this function in order to get close from the browser adaptation : correctRadius
As you will see, im getting this result when TopLEFT, TopRight and BottomLEFT sliders are at max value. The browser (green) is rendering it perfectly, and mine is bad (red).
See snippet below
...ANSWER
Answered 2018-Jan-27 at 12:05The issue is with your correctRadius
function. As you can see you are re-calculating value more than once which is incorrect.
Let's take an example with TopLeft, TopRight and BottomLeft set at max values (100px):
1) You will consider the first condition and you will update your values like this:
TopLeft = 50px | TopRight = 50px (these are correct values)
2) Now you will consider the third condition as you have TL+TB (100px + 50px) > h (100px) and you will update the values like this:
TopLeft = 25px | BottomLeft 75px (these are wrong values and the correct ones should be 50px for both)
So you don't have to calculate values separately, you should consider all of them and do only one calculation for each side depending on initial values.
The idea is to consider the max value of the difference between two adjacent side. Let's consider the same example above and make 3 different values like this:
TL = 100px | TR = 90px | BL = 100px | BR = 0px
TL is adjacent to TR and BL:
- Considering TR we will have
190px > 100px
and thus TL = 45px - Considering BL we will have
200px > 100px
and this TL = 50px
So we should consider the max value which is 50px. We do the same for the other sides.
Here is the full code:
QUESTION
I'm trying to figure out how to reproduce the behavior of the "border-radius" css property into an HTML canvas.
So i've already done something in Javascript in order to compute the correct borders of a given shape, using a specific radius (for each corner).
Here is the previous question if needed : Gecko - CSS layout border radius - Javascript conversion
I've managed to get close from the browser adaptation but there's still an issue, and it seems that it's the last, and the hard part!
Let's take an example in order to explain you the problem
Take a shape of 100px
width & 100px
height. Now apply the following radius to each corner :
- Top left : 37px
- Top right : 100px
- Bottom right : 1px
- Bottom left : 100px
So the css style for this will be border-radius : 37px 100px 1px 100px
Now let's consider using the code below in order to draw this shape in a canvas.
By using the function correctRadius(r, w, h)
in order to avoid bad shapes, each corners will be computed like that :
=> {tl: 18.5, tr: 81.5, br: 0.5, bl: 81.5}
Here is a visual of this :
You will be able to test it in the following snippet
As you can see, the browser shape (green) is overlapped with the canvas shape (brown + 'pink' due to opacity). I've put some opacity on it in order to check the bad corners (pink).
The brown shape do not fit properly into the green shape, the top left corner is getting out of the base, and the bottom left and top right corners don't fit the green shape.
I've already tried to fix that but with no success, and also looked the sources of the Gecko layout engine (https://github.com/mozilla/gecko-dev) in this file : layout/painting/nsCSSRenderingBorders.cpp
, but haven't found anything + i have no skills in C++
If anyone could help me to figure this out, or give me some advice, i'll be able to fix this and get the borders working
...ANSWER
Answered 2018-Jan-28 at 23:15Found the solution !
We just need to compute a scaleRatio
:
First, we get the maxRadiusWidth
(r.tl + r.tr, r.bl + r.br) & maxRadiusHeight
(r.tl + r.bl, r.tr + r.br)
and then a widthRatio = (w / maxRadiusWidth)
& heightRatio = (h / maxRadiusHeight)
with the size of the shape (WIDTH & HEIGHT)
Then we take the lower of theses two variables : Math.min(Math.min(widthRatio, heightRatio), 1)
in order to not get out of the shape & we make sure that
the ratio is below 1.
Finally, we simply need to multiply each corner by this ratio in order to get the correct size !
QUESTION
In a few C programs (for example in gecko) I've noticed an idiom whereby a program will temporarily define a macro, then include a file which uses that macro, then undefine the macro. Here's a trivial example:
speak.c:
...ANSWER
Answered 2017-Dec-06 at 14:36This is a variant of what are often called X macros.
Further reading- The New C: X Macros (Dr Dobbs)
QUESTION
I'd like to use IndexedDB to process a lot of data. Too much data to fit in memory. To do this, I would like to use Firefox's IndexedDB persistent storage, which allows me to store more than 2GB worth of data (Firefox apparently has a limit of 2GB imposed on non-persistent storage).
However, I've run into an issue. Firefox does not appear to be imposing a limit on the amount of data I can store in persistent storage. In fact, if I leave the following sample running, it will apparently run until the disk is full!
Sample (Online) (Must be run in Firefox!):
...ANSWER
Answered 2017-May-04 at 18:07Note the line in the MDN article:
Temporary data storage does not elicit any user prompts, but there are Storage limits.
It could be clearer, but it means Storage limits ONLY apply to temporary storage. So, the global limit and group limit are not in effect for persistent storage.
You can consider switching to temporary storage. But if you need persistent then you may be out of luck until Firefox implements navigator.storageQuota or navigator.storageManager, whichever is settled on.
QUESTION
I wanted to get a list of all my commits to a repository since the start of the year. I tried with the obvious command, but it doesn't include any of them:
...ANSWER
Answered 2017-Jan-07 at 06:39For better or worse (me, I'm in the "worse" camp), git defaults to the current time of day when you specify a date. Try --since='midnight 2016-12-20'
... okay. I haven't deciphered the code yet, but this looks awfully good for it:
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install gecko-dev
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page