chromium/third_party/blink/renderer/core/inspector/inspector_contrast.cc

// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#include "third_party/blink/renderer/core/inspector/inspector_contrast.h"

#include "base/trace_event/trace_event.h"
#include "third_party/blink/renderer/core/css/css_color.h"
#include "third_party/blink/renderer/core/css/css_computed_style_declaration.h"
#include "third_party/blink/renderer/core/css/css_gradient_value.h"
#include "third_party/blink/renderer/core/css/properties/computed_style_utils.h"
#include "third_party/blink/renderer/core/css/properties/longhands.h"
#include "third_party/blink/renderer/core/dom/element.h"
#include "third_party/blink/renderer/core/dom/flat_tree_traversal.h"
#include "third_party/blink/renderer/core/dom/node.h"
#include "third_party/blink/renderer/core/dom/text.h"
#include "third_party/blink/renderer/core/frame/local_frame.h"
#include "third_party/blink/renderer/core/html/canvas/html_canvas_element.h"
#include "third_party/blink/renderer/core/html/html_embed_element.h"
#include "third_party/blink/renderer/core/html/html_image_element.h"
#include "third_party/blink/renderer/core/html/html_object_element.h"
#include "third_party/blink/renderer/core/html/html_picture_element.h"
#include "third_party/blink/renderer/core/html/media/html_video_element.h"
#include "third_party/blink/renderer/core/inspector/inspector_dom_agent.h"
#include "third_party/blink/renderer/core/inspector/inspector_dom_snapshot_agent.h"
#include "third_party/blink/renderer/core/layout/geometry/physical_rect.h"
#include "third_party/blink/renderer/core/layout/layout_view.h"
#include "third_party/blink/renderer/core/style/style_generated_image.h"
#include "ui/gfx/color_utils.h"

namespace blink {

namespace {

bool NodeIsElementWithLayoutObject(Node* node) {}

// Blends the colors from the given gradient with the existing colors.
void BlendWithColorsFromGradient(cssvalue::CSSGradientValue* gradient,
                                 Vector<Color>& colors,
                                 bool& found_non_transparent_color,
                                 bool& found_opaque_color,
                                 const LayoutObject& layout_object) {}

// Gets the colors from an image style, if one exists and it is a gradient.
void AddColorsFromImageStyle(const ComputedStyle& style,
                             const LayoutObject& layout_object,
                             Vector<Color>& colors,
                             bool& found_opaque_color,
                             bool& found_non_transparent_color) {}

PhysicalRect GetNodeRect(Node* node) {}

}  // namespace

InspectorContrast::InspectorContrast(Document* document) {}

void InspectorContrast::CollectNodesAndBuildRTreeIfNeeded() {}

std::vector<ContrastInfo> InspectorContrast::GetElementsWithContrastIssues(
    bool report_aaa,
    size_t max_elements = 0) {}

static bool IsLargeFont(const TextInfo& text_info) {}

ContrastInfo InspectorContrast::GetContrast(Element* top_element) {}

TextInfo InspectorContrast::GetTextInfo(Element* element) {}

Vector<Color> InspectorContrast::GetBackgroundColors(Element* element,
                                                     float* text_opacity) {}

// Get the elements which overlap the given rectangle.
HeapVector<Member<Node>> InspectorContrast::ElementsFromRect(
    const PhysicalRect& rect,
    Document& document) {}

bool InspectorContrast::GetColorsFromRect(PhysicalRect rect,
                                          Document& document,
                                          Element* top_element,
                                          Vector<Color>& colors,
                                          float* text_opacity) {}

// Sorts unsorted_elements in place, first painted go first.
void InspectorContrast::SortElementsByPaintOrder(
    HeapVector<Member<Node>>& unsorted_elements,
    Document* document) {}

}  // namespace blink