Commit Graph

505 Commits

Author SHA1 Message Date
shindli
6bb3487209 Backed out changeset 0c982bc69cb3 (bug 1611415) for causing build bustages in /builds/worker/workspace/build/src/obj-firefox/dist/include/nsCOMPtr CLOSED TREE 2020-02-12 20:13:29 +02:00
Simon Giesecke
d45525793f Bug 1611415 - Applied FixItHints from mozilla-non-std-move. r=froydnj
Differential Revision: https://phabricator.services.mozilla.com/D60980
2020-02-12 17:24:41 +00:00
Jonathan Kingston
6272e1d2e2 Bug 1605814 - Don't capture CSP nonce when loading a child sheet. r=emilio,ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D58686
2020-01-13 11:47:25 +00:00
nordzilla
76b1571d4d Bug 1606727 - Implement CSSStyleSheet Constructor r=emilio
Differential Revision: https://phabricator.services.mozilla.com/D58569
2020-01-07 00:19:53 +00:00
Jonathan Kingston
0f3d8659c7 Bug 1606774 - Change GetAttribute to GetAttr where possible r=baku
Differential Revision: https://phabricator.services.mozilla.com/D58585
2020-01-03 23:40:53 +00:00
Gabriele Svelto
eeb9bfc398 Bug 1600545 - Remove useless inclusions of header files generated from IDL files in accessible/, browser/, caps/, chrome/, devtools/, docshell/, editor/, extensions/, gfx/, hal/, image/, intl/, ipc/, js/, layout/, and media/ r=Ehsan
The inclusions were removed with the following very crude script and the
resulting breakage was fixed up by hand. The manual fixups did either
revert the changes done by the script, replace a generic header with a more
specific one or replace a header with a forward declaration.

find . -name "*.idl" | grep -v web-platform | grep -v third_party | while read path; do
    interfaces=$(grep "^\(class\|interface\).*:.*" "$path" | cut -d' ' -f2)
    if [ -n "$interfaces" ]; then
        if [[ "$interfaces" == *$'\n'* ]]; then
          regexp="\("
          for i in $interfaces; do regexp="$regexp$i\|"; done
          regexp="${regexp%%\\\|}\)"
        else
          regexp="$interfaces"
        fi
        interface=$(basename "$path")
        rg -l "#include.*${interface%%.idl}.h" . | while read path2; do
            hits=$(grep -v "#include.*${interface%%.idl}.h" "$path2" | grep -c "$regexp" )
            if [ $hits -eq 0 ]; then
                echo "Removing ${interface} from ${path2}"
                grep -v "#include.*${interface%%.idl}.h" "$path2" > "$path2".tmp
                mv -f "$path2".tmp "$path2"
            fi
        done
    fi
done

Differential Revision: https://phabricator.services.mozilla.com/D55443
2019-12-06 09:16:44 +00:00
Emilio Cobos Álvarez
e42006ba6b No bug - Fix up a CSS Loader comment to be more accurate. r=bzbarsky
The "has been exposed to CSSOM" thing is a much weaker test, which was meant to
stand for "has been modified or might be modified". We don't care about the
"might be modified" bit anymore, since we don't share rules in that case.

Differential Revision: https://phabricator.services.mozilla.com/D55717
2019-12-03 20:35:20 +00:00
Emilio Cobos Álvarez
7af655c29a Bug 1590280 - Allow to use the sheet cache to avoid parsing as long as CSSOM hasn't mutated the stylesheet. r=heycam
We need to ensure we have a unique inner so that ruleLists and such have the
right pointer identity (we could do better, really, but it's harder).

But as long as the CSSOM hasn't modified them there should be no reason not to
use the cache. We can do a deep clone synchronously instead of refetching /
reparsing.

This is important because, as of right now, just using the inspector makes the
stylesheets unique, which is unfortunate.

We'll still have the modified rule bit for sheets with @import, because our
notification system for @import is silly, and on parents of imported sheets.

Fixing those are future improvements, but I see no reason not to land this.

Differential Revision: https://phabricator.services.mozilla.com/D55163
2019-12-03 11:04:03 +00:00
Emilio Cobos Álvarez
4e72e95050 Bug 1600624 - Make the StyleSheet children setup simpler. r=heycam
Using an array is much better to reason about than a manually linked list, and
allows us to preserve @import order.

Added a test for a bug that we happened not to have, but that it's not covered
by existing WPT tests.

Differential Revision: https://phabricator.services.mozilla.com/D55565
2019-12-03 10:49:23 +00:00
Emilio Cobos Álvarez
a6bfa4b95b Bug 1600376 - Remove useless namespace qualifications in layout/style. r=jwatt
All these things are in the mozilla namespace and such. Clean up a bit.

Differential Revision: https://phabricator.services.mozilla.com/D55319
2019-11-30 11:57:10 +00:00
Honza Bambas
4ae17bd66f Bug 1594449 - <link rel="preload"> implemented as a speculative load initiated during the prescan phase in the HTML5 parser, disabled by default, only supports "script" and "styles" types, r=ckerschb
Differential Revision: https://phabricator.services.mozilla.com/D52019
2019-11-27 21:45:12 +00:00
Daniel Holbert
9430a58263 Bug 1590639 part 4: Fix non-unified build issues in layout/style. r=emilio
This patch:

- Gives layout/generic/AnonymousContentKey.h an include for `<stdint.h>` to
  provide the uint8_t type, and TypedEnumBits.h to provide the
  MOZ_MAKE_ENUM_CLASS_BITWISE_OPERATORS macro. (This is a change in another
  directory, but it's needed in order for layout/style/ServoStyleSet.cpp to
  build successfully.)
- Adds a missing "nsINode" forward-decl to dom/base/IdentifierMapEntry.h,
  because it uses that type in function declarations.  (This change is needed
  in order for layout/style/CachedInheritingStyles.cpp to build successfully.)
- Gives CSSStyleRule.cpp an include for PseudoStyleType.h,
  nsCSSPseudoElements.h, and CSSEnabledState.h because it uses those types.
- Gives GeckoBindings.cpp an include for gfxTextRun.h, to provide the definition
  of type gfxFontGroup (so GeckoBindings can call GetFirstValidFont() on an
  object of that type).
- Gives Loader.h an include for nsIContentInlines.h, to provide the inline
  function IsInUAWidget().
- Gives Rule.cpp an include for HoldDropJSObjects.h, to provide DropJSObjects().
- Gives nsImageLoader.cpp an include for DocumentInlines.h (and Document.h for
  good measure), to provide the inline function GetPresContext().
- Gives nsStyleStruct.cpp an include for DocumentInlines.h, to provide inline
  function Document::GetPresContext().
- Gives nsStyleTransformMatrix.h an include for Units.h (instead of gfxPoint.h,
  which isn't useful) to provide the CSSPoint type.
- Gives nsStyleTransformMatrix.h an include for ServoStyleConsts.h, to provide
  LengthPercentage and the various StyleRotate/StyleScale/StyleTransform/etc
  types. (These can't be easily forward-declared, because some of them are
  legitimate types whereas others are type aliases. We could theoretically
  forward-declare all of the underlying types and then repeat the type aliases,
  but that'd be verbose and unmaintainable.)

Depends on D50165

Differential Revision: https://phabricator.services.mozilla.com/D50166
2019-10-23 08:14:54 +00:00
Sylvestre Ledru
49802d0a8e Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D47737
2019-10-06 18:29:55 +00:00
Emilio Cobos Álvarez
6d4b478929 Bug 1582374 - Add a warning when we find usage of the CSS zoom property. r=smaug,flod
Now that we count them, I think we should do this.

This property is pretty painful for various reasons:

 * It's a pretty awkward non-standard property.
 * Has a pretty short name, so people use it instead of the standard
   alternatives.
 * We cannot really even implement it easily anyhow, without breaking a whole
   bunch of stuff, because pages do things like:

```
myelement {
  zoom: 0.5;
  -moz-transform: scale(0.5);
  transform-origin: 0 0;
}
```

For now this is only recorded when CSS use counters are enabled (Nightly for
now), but I want to change it once bug 1578661 is in central.

The hope is that this warning slightly raises awareness of this property not
being standard. You get a CSS parsing error in the console, but those are
usually too noisy and disabled by default.

Differential Revision: https://phabricator.services.mozilla.com/D46430
2019-09-20 01:31:35 +00:00
Emilio Cobos Álvarez
bf45cc18ec Bug 1574718 - followup: Also actually unlink it. r=heycam
MANUAL PUSH: Minor post-landing follow-up.
2019-09-04 09:15:43 +02:00
Emilio Cobos Álvarez
41061835e2 Bug 1574718 - Cycle-collect inline-sheet cache. r=heycam
This is an oversight from the initial implementation of the cache.

Differential Revision: https://phabricator.services.mozilla.com/D43975
2019-09-04 06:27:00 +00:00
Thomas Nguyen
a688b675a4 Bug 1528697 - Expose ReferrerPolicy.webidl and use referrerpolicy enum r=smaug
ReferrerPolicy gets tossed back and forth as a uint32_t and
ReferrerPolicy enum in header file. Expose ReferrerPolicyValues from
webidl file and use consistently in native code.

Differential Revision: https://phabricator.services.mozilla.com/D41954
2019-08-21 13:24:45 +00:00
Emilio Cobos Álvarez
e19e3499f0 Bug 1480146 - Add memory reporting for the inline style cache. r=heycam
MANUAL PUSH: Splitting a stack after the fact to avoid getting the main patch backed out due to talos timeouts.

Differential Revision: https://phabricator.services.mozilla.com/D41731
2019-08-19 14:55:01 +02:00
Emilio Cobos Álvarez
629354026d Bug 1480146 - Add a cache for inline stylesheets without @import rules. r=heycam
Supporting @import was much more annoying (I had a patch but it became much more
complex than this), and seems other browsers don't do it either:

  https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/css/style_sheet_contents.cc?l=149&rcl=1999822baf4dc673088e65997fa07ad158f2e166
  https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/css/StyleSheetContents.cpp?rev=246490#L111

Also added a singleton perf test for <link> caching.

Maybe we should add some cache eviction here, but I'm not sure what'd be the
best policy here.

Differential Revision: https://phabricator.services.mozilla.com/D41564
2019-08-19 14:53:50 +02:00
Ciure Andrei
23dbc196b4 Backed out 2 changesets (bug 1480146) for causing inline-style-cache-1.html timeouts CLOSED TREE
Backed out changeset 8e3a8dd3189d (bug 1480146)
Backed out changeset 2bcd5ea241cd (bug 1480146)
2019-08-19 14:29:28 +03:00
Emilio Cobos Álvarez
1d23d8d1c2 Bug 1480146 - Add memory reporting for the inline style cache. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D41731
2019-08-17 03:13:20 +00:00
Emilio Cobos Álvarez
eaf6af860e Bug 1480146 - Add a cache for inline stylesheets without @import rules. r=heycam
Supporting @import was much more annoying (I had a patch but it became much more
complex than this), and seems other browsers don't do it either:

  https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/css/style_sheet_contents.cc?l=149&rcl=1999822baf4dc673088e65997fa07ad158f2e166
  https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/css/StyleSheetContents.cpp?rev=246490#L111

Maybe we should add some cache eviction here, but I'm not sure what'd be the
best policy here.

Differential Revision: https://phabricator.services.mozilla.com/D41564
2019-08-19 07:52:09 +00:00
Mihai Alexandru Michis
959b78e854 Backed out 2 changesets (bug 1480146) for causing talos perf reftest to timeout in link-style-cache-1.html
Backed out changeset ff3ba7a16c21 (bug 1480146)
Backed out changeset f47314ec33ff (bug 1480146)
2019-08-17 04:48:35 +03:00
Emilio Cobos Álvarez
873800b050 Bug 1480146 - Add memory reporting for the inline style cache. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D41731
2019-08-16 10:56:25 +00:00
Emilio Cobos Álvarez
adb5ebe6d8 Bug 1480146 - Add a cache for inline stylesheets without @import rules. r=heycam
Supporting @import was much more annoying (I had a patch but it became much more
complex than this), and seems other browsers don't do it either:

  https://cs.chromium.org/chromium/src/third_party/blink/renderer/core/css/style_sheet_contents.cc?l=149&rcl=1999822baf4dc673088e65997fa07ad158f2e166
  https://trac.webkit.org/browser/webkit/trunk/Source/WebCore/css/StyleSheetContents.cpp?rev=246490#L111

Also added a singleton perf test for <link> caching.

Maybe we should add some cache eviction here, but I'm not sure what'd be the
best policy here.

Differential Revision: https://phabricator.services.mozilla.com/D41564
2019-08-16 10:56:23 +00:00
Emilio Cobos Álvarez
7670c060f1 Bug 1571530 - Remove sheets from the <link> cache when they have been touched by CSS OM. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D41563
2019-08-16 10:56:22 +00:00
Emilio Cobos Álvarez
422edc6de6 Bug 1571530 - Move a bit of code around in Loader::LoadInlineSheet. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D41562
2019-08-16 10:56:20 +00:00
Emilio Cobos Álvarez
a7ac58e0fb Bug 1571530 - Make PrepareSheet take a reference. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D41561
2019-08-16 10:56:18 +00:00
Emilio Cobos Álvarez
2c24a60312 Bug 1571530 - Cleanup slightly SheetComplete, and use the right boolean to notify. r=heycam
This is mostly straight-forward cleanup, but there's a behavior change which
was an oversight from bug 1386840, the regular mObservers stuff didn't pass the
right thing (was passing only mWasAlternate rather than whether it was
deferred).

I think that as a result, only in XML documents (since nsXMLContentSink is the
only thing that adds itself as a global CSS loader observer that ever looks at
this boolean), we may end up breaking this assert:

https://searchfox.org/mozilla-central/rev/9ae20497229225cb3fa729a787791f424ff8087b/dom/base/nsContentSink.cpp#183

(If there are any sheets with non-matching media queries and such).

But I couldn't find a test-case that broke it (tried SVG / XHTML), and in other
documents like pure XML you cannot specify a media query...

Differential Revision: https://phabricator.services.mozilla.com/D41091
2019-08-16 10:56:16 +00:00
Emilio Cobos Álvarez
b79e7d563f Bug 1571530 - Cleanup confusing lifetime of SheetLoadData. r=heycam
Saving a refcount bump is not worth the churn. Use a proper RefPtr<>
everywhere instead of manual refcounting, and don't make DoSheetComplete call
NS_RELEASE unconditionally.

Also, make clear by using references where null is expected or not.

Also, properly use a RefPtr in mPendingDatas, since they are strong pointers,
in fact.

Finally, remove some unused macros from nsCSSValue of which this code was the
last consumer.

Differential Revision: https://phabricator.services.mozilla.com/D41090
2019-08-16 10:56:09 +00:00
Emilio Cobos Álvarez
0f705557ce Bug 1571530 - Don't use nsBaseHashtable in the CSS loader. r=heycam
It's a refptr hashtable, really.

Differential Revision: https://phabricator.services.mozilla.com/D41027
2019-08-16 10:56:07 +00:00
Emilio Cobos Álvarez
22e86790cb Bug 1571530 - Remove various bool arguments in sheet loader APIs. r=heycam
They're bad, specially if they do vastly different thing in overloaded
functions, like aUseSystemPrincipal and aIsPreload. :)

Differential Revision: https://phabricator.services.mozilla.com/D40851
2019-08-16 10:56:05 +00:00
Emilio Cobos Álvarez
586f87c3c8 Bug 1571530 - Make Loader APIs return a Result. r=heycam
On the fence on this one, but I do think it's nicer.

Differential Revision: https://phabricator.services.mozilla.com/D40850
2019-08-16 10:56:03 +00:00
Emilio Cobos Álvarez
5ce817cdd3 Bug 1571530 - Move inline sheet creation somewhere else that isn't CreateSheet. r=heycam
It doesn't do much for them.

Differential Revision: https://phabricator.services.mozilla.com/D40847
2019-08-16 10:55:56 +00:00
Emilio Cobos Álvarez
30777632cd Bug 1571530 - Cleanup CreateSheet so that it returns its arguments rather than having outparams. r=heycam
Also, it's infallible, so no need to have an error state.

Differential Revision: https://phabricator.services.mozilla.com/D40693
2019-08-16 10:55:54 +00:00
Emilio Cobos Álvarez
8a118cee53 Bug 1571530 - Factor out the stylesheet cache bits. r=heycam
Just moving code around but hopefully the new code is nicer :)

Also fix a regression I introduced in D40691 where the parsing mode wouldn't be
checked for XUL sheets.

Differential Revision: https://phabricator.services.mozilla.com/D40692
2019-08-16 10:55:50 +00:00
Daniel Holbert
8865537b64 Bug 1574310: clang-reformat the layout directory. (no review, just doing automated reformatting)
This patch is auto-generated by the following command:
./mach clang-format -p layout/

Differential Revision: https://phabricator.services.mozilla.com/D42218
2019-08-15 22:13:49 +00:00
Emilio Cobos Álvarez
187836b028 Bug 1571530 - Trivially cleanup a condition. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D41089
2019-08-13 09:16:33 +00:00
Emilio Cobos Álvarez
3ada4cc148 Bug 1571530 - Make the parsing mode part of the cache key. r=heycam
Rather than checking after-the fact and dropping the cached result on the floor.

Depends on D40690

Differential Revision: https://phabricator.services.mozilla.com/D40691
2019-08-13 09:06:09 +00:00
Emilio Cobos Álvarez
e642a2173f Bug 1571530 - Move SheetLoadData out of line too. r=heycam
Now that Sheets is out of line this can move to the cpp file too.

Depends on D40689

Differential Revision: https://phabricator.services.mozilla.com/D40690
2019-08-13 09:05:59 +00:00
Emilio Cobos Álvarez
00aaf5f0f7 Bug 1571530 - Cleanup initialization and usage of Loader::mSyncCallback. r=heycam
Little pet peeve o' mine.

Depends on D40687

Differential Revision: https://phabricator.services.mozilla.com/D40688
2019-08-13 05:12:28 +00:00
Emilio Cobos Álvarez
e0aba39902 Bug 1571530 - Move Loader::Sheets out of line. r=heycam
I'm going to tweak it a bit.

Differential Revision: https://phabricator.services.mozilla.com/D40687
2019-08-13 05:08:50 +00:00
Sylvestre Ledru
3067b10938 Bug 1519636 - Reformat recent changes to the Google coding style r=Ehsan
# ignore-this-changeset

Differential Revision: https://phabricator.services.mozilla.com/D41559
2019-08-13 07:15:25 +00:00
Emilio Cobos Álvarez
f035194a14 Bug 1571530 - Don't uselessly check for OOM in Loader::PostLoadEvent. r=heycam
MANUAL PUSH: This part of the stack is independent and has been reviewed sooner, so can land now.

Differential Revision: https://phabricator.services.mozilla.com/D40849
2019-08-09 13:17:42 +02:00
Emilio Cobos Álvarez
331212e8a0 No bug - Improve CSS loader logging. 2019-08-05 10:58:56 +02:00
Thomas Nguyen
8e17cce240 Bug 1546334 - Use referrerInfo in style system. r=heycam
Differential Revision: https://phabricator.services.mozilla.com/D36478
2019-07-16 11:43:56 +00:00
Thomas Nguyen
52d7404b44 Bug 1546334 - Store separate referrerInfo in SheetLoadData and StyleSheetInfo r=heycam
The referrerInfo in SheetLoadData and StyleSheetInfo should be
different. One is used to load a style sheet and the other is used to
load resources referenced by a style sheet.

Differential Revision: https://phabricator.services.mozilla.com/D36477
2019-07-16 11:43:39 +00:00
Boris Zbarsky
ed4f8b7e51 Bug 1565767 part 5. Remove some unnecesary refcounting at nsIContent::GetBaseURI callsites. r=peterv
Differential Revision: https://phabricator.services.mozilla.com/D37973
2019-07-15 18:29:05 +00:00
Boris Zbarsky
8e16a497d9 Bug 1557793 part 3. Change the signatures of various nsContentUtils localization methods to play nicer with the new stringbundle API. r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D34201
2019-06-08 21:26:12 +00:00
Thomas Nguyen
2b9a6d0f8d Bug 1532318 - Part 2 : update changes of nsIHttpChannel in codebase r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D22786
2019-05-02 12:33:55 +00:00