mirror of
https://github.com/servo/servo.git
synced 2025-06-22 08:08:59 +01:00
style: Disable :visited if the document is being used as an image.
Bug: 1420001 Reviewed-by: dholbert MozReview-Commit-ID: F9MeT1kXZER
This commit is contained in:
parent
6d49ec83a1
commit
f94601d0a7
1 changed files with 23 additions and 2 deletions
|
@ -164,12 +164,20 @@ impl PerDocumentStyleDataImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns whether private browsing is enabled.
|
/// Returns whether private browsing is enabled.
|
||||||
pub fn is_private_browsing_enabled(&self) -> bool {
|
fn is_private_browsing_enabled(&self) -> bool {
|
||||||
let doc =
|
let doc =
|
||||||
self.stylist.device().pres_context().mDocument.raw::<nsIDocument>();
|
self.stylist.device().pres_context().mDocument.raw::<nsIDocument>();
|
||||||
unsafe { bindings::Gecko_IsPrivateBrowsingEnabled(doc) }
|
unsafe { bindings::Gecko_IsPrivateBrowsingEnabled(doc) }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns whether the document is being used as an image.
|
||||||
|
fn is_being_used_as_an_image(&self) -> bool {
|
||||||
|
let doc =
|
||||||
|
self.stylist.device().pres_context().mDocument.raw::<nsIDocument>();
|
||||||
|
|
||||||
|
unsafe { (*doc).mIsBeingUsedAsImage() }
|
||||||
|
}
|
||||||
|
|
||||||
/// Get the default computed values for this document.
|
/// Get the default computed values for this document.
|
||||||
pub fn default_computed_values(&self) -> &Arc<ComputedValues> {
|
pub fn default_computed_values(&self) -> &Arc<ComputedValues> {
|
||||||
self.stylist.device().default_computed_values_arc()
|
self.stylist.device().default_computed_values_arc()
|
||||||
|
@ -179,9 +187,22 @@ impl PerDocumentStyleDataImpl {
|
||||||
fn visited_links_enabled(&self) -> bool {
|
fn visited_links_enabled(&self) -> bool {
|
||||||
unsafe { structs::StylePrefs_sVisitedLinksEnabled }
|
unsafe { structs::StylePrefs_sVisitedLinksEnabled }
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Returns whether visited styles are enabled.
|
/// Returns whether visited styles are enabled.
|
||||||
pub fn visited_styles_enabled(&self) -> bool {
|
pub fn visited_styles_enabled(&self) -> bool {
|
||||||
self.visited_links_enabled() && !self.is_private_browsing_enabled()
|
if !self.visited_links_enabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.is_private_browsing_enabled() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
if self.is_being_used_as_an_image() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
true
|
||||||
}
|
}
|
||||||
|
|
||||||
/// Measure heap usage.
|
/// Measure heap usage.
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue